plugin Terminal
plugin Terminal
Adds panel "Terminal" to the bottom panel of CudaText. It is emulation of terminal (default: Bash on Unix, Cmd on Windows). You can enter commands in this terminal, and see output from shell.
Limitation: don't use interactive commands, which need keyboard input.
Plugin has several options in the .ini file - call menu item Options/ Settings-plugins/ Terminal/ Config.
Hotkeys in the terminal:
- Down arrow: show last commands (history) menu
- Esc: close terminal and focus editor
- Break: interrupt/restart shell process
Limitation: don't use interactive commands, which need keyboard input.
Plugin has several options in the .ini file - call menu item Options/ Settings-plugins/ Terminal/ Config.
Hotkeys in the terminal:
- Down arrow: show last commands (history) menu
- Esc: close terminal and focus editor
- Break: interrupt/restart shell process
Update
2020.07.09.5
* change: on choosing item in drop-down menu, place item to input field
+ add: option 'dark_colors'
+ add: option 'shell_unix'
+ add: option 'shell_windows'
- fix: initially, input was not focused
2020.07.05
+ add: increase read buffer size (1 byte->6K) to not freeze on big tools output
+ add: option "max_buffer_size" (default 100K) to not take too much memory
2020.07.09.5
* change: on choosing item in drop-down menu, place item to input field
+ add: option 'dark_colors'
+ add: option 'shell_unix'
+ add: option 'shell_windows'
- fix: initially, input was not focused
2020.07.05
+ add: increase read buffer size (1 byte->6K) to not freeze on big tools output
+ add: option "max_buffer_size" (default 100K) to not take too much memory
https://github.com/OlehL/cuda_differ/issues/82
A theoretical question of a noob regarding colored output: is just parsing the colors with ansiterm and colorizing text with 'Editor.attr' not a viable strategy? Haven't actually tried it, but it looks like it should work...
A theoretical question of a noob regarding colored output: is just parsing the colors with ansiterm and colorizing text with 'Editor.attr' not a viable strategy? Haven't actually tried it, but it looks like it should work...
-
- Posts: 392
- Joined: 01.12.2020 13:46
ansiterm parsing seems to work
gives me red bold tiles in grep output. Will play with it more
Code: Select all
term = ansiterm.Ansiterm(25, 80)
term.feed(self.btext.decode('utf-8'))
ts = term.get_tiles(0, 25*80)
Well the parsing works: picture
"grep" and "ls" give colored output when I add "--color=always". But not with "--color=auto". I copied my working environment variables and it is still doesn't work. So I am kinda lost at the moment
Will try to look at how the "--color=auto" works in the sources...
"grep" and "ls" give colored output when I add "--color=always". But not with "--color=auto". I copied my working environment variables and it is still doesn't work. So I am kinda lost at the moment
Will try to look at how the "--color=auto" works in the sources...
-
- Posts: 392
- Joined: 01.12.2020 13:46
A few things I found out:
You can trick the commands into thinking they are running in the terminal (that is what "ls" checks when "--color=auto") by running them thusly:
(NOTE about "ls": by default coloring is disabled, but real terminal adds "--color=auto" with alias from ".bashrc")
Coloring large text one character at a time is a bad idea
For me parsing 2700 lines (100kB) of fully colored "ls" output takes 0.7s, and coloring it (self.memo.attr(MARKERS_ADD, ...) takes 2.3s. Quite a freeze
I hope this will be of some help.
In case it will help, here is my current terminal plugin code: github
And the parser I fixed a bit: github
You can trick the commands into thinking they are running in the terminal (that is what "ls" checks when "--color=auto") by running them thusly:
Code: Select all
script --return --quiet -c "ls -l --color=auto" /dev/null
Coloring large text one character at a time is a bad idea
For me parsing 2700 lines (100kB) of fully colored "ls" output takes 0.7s, and coloring it (self.memo.attr(MARKERS_ADD, ...) takes 2.3s. Quite a freeze
I hope this will be of some help.
In case it will help, here is my current terminal plugin code: github
And the parser I fixed a bit: github
-
- Posts: 392
- Joined: 01.12.2020 13:46
you can speed-up the MARKERS_ADD many calls:
MARKERS_ADD_MANY: Adds one or multiple fragments at once. Also returns number of fragments. Parameters:
"x", "y", "len": The same as for MARKERS_ADD, but can be also list/tuple of int. Lists/tuples must contain the equal number of elements (otherwise the minimal number of elements will be used).
other parameters: The same as for MARKERS_ADD.