veksha / cuda_exterminal Goto Github PK
View Code? Open in Web Editor NEWExTerminal is an addon for CudaText
ExTerminal is an addon for CudaText
def config(self):
self.save_ops()
file_open(ini)
lines = [ed.get_text_line(i) for i in range(ed.get_line_count())]
try:
index = lines.index('['+section+']')
ed.set_caret(0, index)
except:
pass
consider to make Esc going to editor (focus editor). at least by option 'esc_focuses_editor=1'.
import cudatext_cmd as cmds
...
ed.cmd(cmds.cmd_FocusEditor)
Python 3.8.10
Init: cuda_project_man
Loading project: ~/cuda/cuda/app/settings/temporary.cuda-proj
Startup: 1360ms, plugins: 360ms (project_man 364ms)
Init: cuda_exterminal
Init: cudatext
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1169, in _timer_proc_callback_proxy
return _live[info](tag)
File "/home/user/cuda/cuda/app/py/cuda_exterminal/terminal.py", line 210, in timer_update
self.screen.memo_update()
File "/home/user/cuda/cuda/app/py/cuda_exterminal/memoscreen.py", line 117, in memo_update
m = list(zip(*markers))
TypeError: 'NoneType' object is not iterable
ERROR: Exception in CudaText for cudatext._timer_proc_callback_proxy: TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1169, in _timer_proc_callback_proxy
return _live[info](tag)
File "/home/user/cuda/cuda/app/py/cuda_exterminal/terminal.py", line 210, in timer_update
self.screen.memo_update()
File "/home/user/cuda/cuda/app/py/cuda_exterminal/memoscreen.py", line 117, in memo_update
m = list(zip(*markers))
TypeError: 'NoneType' object is not iterable
ERROR: Exception in CudaText for cudatext._timer_proc_callback_proxy: TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1169, in _timer_proc_callback_proxy
return _live[info](tag)
File "/home/user/cuda/cuda/app/py/cuda_exterminal/terminal.py", line 210, in timer_update
self.screen.memo_update()
File "/home/user/cuda/cuda/app/py/cuda_exterminal/memoscreen.py", line 117, in memo_update
m = list(zip(*markers))
TypeError: 'NoneType' object is not iterable
ERROR: Exception in CudaText for cudatext._timer_proc_callback_proxy: TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1169, in _timer_proc_callback_proxy
return _live[info](tag)
File "/home/user/cuda/cuda/app/py/cuda_exterminal/terminal.py", line 210, in timer_update
self.screen.memo_update()
File "/home/user/cuda/cuda/app/py/cuda_exterminal/memoscreen.py", line 117, in memo_update
m = list(zip(*markers))
TypeError: 'NoneType' object is not iterable
ERROR: Exception in CudaText for cudatext._timer_proc_callback_proxy: TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1169, in _timer_proc_callback_proxy
return _live[info](tag)
File "/home/user/cuda/cuda/app/py/cuda_exterminal/terminal.py", line 210, in timer_update
self.screen.memo_update()
File "/home/user/cuda/cuda/app/py/cuda_exterminal/memoscreen.py", line 117, in memo_update
m = list(zip(*markers))
TypeError: 'NoneType' object is not iterable
ERROR: Exception in CudaText for cudatext._timer_proc_callback_proxy: TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1169, in _timer_proc_callback_proxy
return _live[info](tag)
File "/home/user/cuda/cuda/app/py/cuda_exterminal/terminal.py", line 210, in timer_update
self.screen.memo_update()
File "/home/user/cuda/cuda/app/py/cuda_exterminal/memoscreen.py", line 117, in memo_update
m = list(zip(*markers))
TypeError: 'NoneType' object is not iterable
ERROR: Exception in CudaText for cudatext._timer_proc_callback_proxy: TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1169, in _timer_proc_callback_proxy
return _live[info](tag)
File "/home/user/cuda/cuda/app/py/cuda_exterminal/terminal.py", line 210, in timer_update
self.screen.memo_update()
File "/home/user/cuda/cuda/app/py/cuda_exterminal/memoscreen.py", line 117, in memo_update
m = list(zip(*markers))
TypeError: 'NoneType' object is not iterable
ERROR: Exception in CudaText for cudatext._timer_proc_callback_proxy: TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1169, in _timer_proc_callback_proxy
return _live[info](tag)
File "/home/user/cuda/cuda/app/py/cuda_exterminal/terminal.py", line 210, in timer_update
self.screen.memo_update()
File "/home/user/cuda/cuda/app/py/cuda_exterminal/memoscreen.py", line 117, in memo_update
m = list(zip(*markers))
TypeError: 'NoneType' object is not iterable
ERROR: Exception in CudaText for cudatext._timer_proc_callback_proxy: TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1169, in _timer_proc_callback_proxy
return _live[info](tag)
File "/home/user/cuda/cuda/app/py/cuda_exterminal/terminal.py", line 210, in timer_update
self.screen.memo_update()
File "/home/user/cuda/cuda/app/py/cuda_exterminal/memoscreen.py", line 117, in memo_update
m = list(zip(*markers))
TypeError: 'NoneType' object is not iterable
ERROR: Exception in CudaText for cudatext._timer_proc_callback_proxy: TypeError: 'NoneType' object is not iterable
Saved session: "history session.json", 0 file(s), by timer at 10:54:28
Saved session: "history session.json", 0 file(s), by timer at 10:54:58
Hi Yuriy! (Юрий!)
looks promising! very promising : - )
a few suggestions (not so critical, sure…), as potential enhancements…
• run selection from editor
• run current tab/file at exterminal
• shortcut for switch focus between exterminal and editor
From Markus.
patches-term.zip
@veksha
@Alexey-T, Hi. This is terminal emulator that can be better then Terminal+. This is work in progress, some bugs are present.
But the main thing that I want to deal with right now is colorizing speed.
I think this line is slowing down plugin a lot:
self.memo.attr(MARKERS_ADD, x=x, y=y, len=1, color_font=fg, color_bg=bg, font_bold=bold)
if this line somehow can be optimized in pascal code -> GOOD.
If not, we can think of another API that will be capable to colorize faster then markers.
try for yourself.
make sure you enable colors in config!
notice how without colors it's pretty fast, but colors slow down a lot.
@Alexey-T
Given that we already have icons near bottom panel the tabs feature is not really necessary.
Also, floating mode can be removed too, because we can toggle floating mode of the whole bottom panel.
I'm trying to follow KISS principle. And I want to hear your point of view. What is the Cud's way.
Why Terminal+ implemented "tabs statusbar" and floating mode when all functionality was already present in Cud.
I mean:
Xubuntu 20
IS_WIN = os.name=='nt'
ENC = 'utf8'
Python 3.8.10
Init: cuda_breadcrumbs
Loaded session: "history session.json", 20ms, 1 file(s)
Init: cuda_hilite_occurrences
Startup: 230ms, plugins: 30ms (breadcrumbs 28ms, hilite_occurrences 6ms)
Init: cuda_example_terminal
Init: cudatext
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Traceback (most recent call last):
File "/home/user/cuda/cuda/app/py/cudatext.py", line 1232, in _dlg_proc_callback_proxy
return _live[info](id_dlg, id_ctl, data=data)
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 247, in form_key_down
if is_toggle_focus_hotkey(key, data):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 476, in is_toggle_focus_hotkey
for hotkey in get_hotkeys('toggle_focus'):
File "/home/user/cuda/cuda/app/py/cuda_example_terminal/terminal.py", line 463, in get_hotkeys
cfg_keys= [(cmd['key1'], cmd['key2'])
IndexError: list index out of range
ERROR: Exception in CudaText for cudatext._dlg_proc_callback_proxy: IndexError: list index out of range
Is it possible to be the same size as the output panel?
python usually uses such_casing_of_file_names. Or even without '_'.
user@user-HP-Pavilion-g6-Notebook-PC:~/Desktop$ exit
exit
sdf
sfd
sdf
sdf
plugin is unresponsive now-- i type 'sdf' and nothing
if app_api_version() >= '1.0.425'
Xubuntu 20
when opening .pas file, CudaText tells that it can download PAX_Pascal lexer for this file.
but when you agree and install, it will not be added to lexer list.
I don't know what is PAX but i assume that at least it must be shown in lexer list after installing.
Cache menu id, pls
e.g. on linux it cann be '/bin/bash/ and /usr/bin/bash'.
Also, BSD systems and MacOS need their separate option, different from Linux one
"shell" for Windows
"shell_linux"
"shell_macos"
"shell_freebsd"
"shell_openbsd"
"shell_netbsd"
"shell_dragonfly"
Ubuntu 20
[Errno 2] No such file or directory: ''
/bin/bash
main PC: I already have bash as /bin/bash so why the error??
Once ExTerminal's window is shown, CudaText starts to consume 5% of CPU. Even when the ExTerminal's window is closed, the CPU consumption remains 5%.
After looking into the code, I've seemed to identify the potential fix.
The method run
of the ControlTh
class contains a while True
loop that calls read()
again and again. I believe this is the source of the CPU usage. The logical fix is to introduce some delay when nothing has been read from the pipe:
if s:
pass; DEBUG_READ and print(s)
self.add_buf(s)
else:
sleep(0.05) # reduces CPU usage while doing nothing!
I tested it under Windows, and this simple fix reduced the CPU usage from 5% to 0.5%.
maybe @JairoMartinezA can test this plugin on macOS?
If not, I will test it on my old macbook, in few weeks.
if we have only 3 opts (or even 6) it's better to REuse settings/plugins.ini,
section 'ex_terminal'.
Does ExTerminal support command history? I tried Up/Down as well as Alt+Up/Alt+Down and Ctrl+Up/Ctrl+Down to get the previous/next command from the history - no luck. (I tried that under Windows).
In the same time, searching for a word "history" in the source code of the plugin creates an impression that there is a potential ability to have commands history.
Moreover, when I press PageUp/PageDown, I seem to get the very first and very last command from the command history.
How can I scroll through the command history in ExTerminal?
Terminal Advanced
Terminal Ultra
Terminal Ex
maybe disable the menuitem (menu_proc()
can disable items) if called on the initial plugin sidebar icon?
for the wiki
https://wiki.freepascal.org/CudaText_plugins#Terminal
I wanted to copy/paste terminal memo contents.
i select it here but plugin resets the selection!
Let me ask you for advice, please.
Basing on the code of your plugin and on the article mentioned below, I tried to use the PseudoConsole technique in C++ code (under Windows 10). The article is:
https://learn.microsoft.com/en-us/windows/console/creating-a-pseudoconsole-session
I seemed to follow everything that you do in your Python code, as well as in the code from the mentioned article, but the actual result that I read from the PseudoConsole by ReadFile() is unexpectedly full of Escape Codes. For example:
awk --version
�[2J�[m�[Ha�]0;C:\tools\awk\awk.exe��[?25hwk version 20121220
tcc --version
�[2J�[m�[Htcc: error: invalid option -- '--version'
�]0;C:\tools\tcc\tcc.exe��[?25h
As far as I can see, these unreadable characters correspond to the ESC [ ...
and ESC ] ...
Escape Codes. I have no idea why they are read by ReadFile() and how can I get rid of them.
As your plugin's output does not contain anything like this, I'm hoping you might give me some hint if you faced something similar during development? And if you did, how have you fixed that?
Hello @Alexey-T.
ExTerminal (or CudaText) has two issues.
ctrl-shift-p
while ExTerminal is focused, this hotkey will not go outside of ExTerminal and nothing will happen, but on Linux it goes to main CudaText Window and invokes Command palette.Is it possible to have the floating terminal separate from the output panel?
from Markus F:
patches.zip
Hi, @Alexey-T
I want ExTerminal to support URLs underline. they are working already, but in colorful mode underlined style is covered by my custom markers. I know that URL markers (id=-100) can't be removed, and it's okay, I want their underlined style to be on top of other attribs.
look at screenshot. only the first letter is underlined. (maybe it is covered by custom marker with len=1 and its len resized to 1? just a guess.)
without colors underline is ok for all letters.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.