Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exmode command 'set' does not seem to work #196

Closed
smemsh opened this issue Nov 12, 2022 · 11 comments
Closed

exmode command 'set' does not seem to work #196

smemsh opened this issue Nov 12, 2022 · 11 comments

Comments

@smemsh
Copy link
Contributor

smemsh commented Nov 12, 2022

meson compile, latest master with exmode support:

:set ui.show_title_bar = 0<enter>

accepts exmode input without error, but nothing happens on <enter>. tried refresh, etc no change. is :set supposed to work? :quit seems to work. :bind seems to work.

I also tried elinks -eval 'set ui.show_title_bar = 0 which only works with -no-connect, so I cannot use it to change values in session master.

@rkd77
Copy link
Owner

rkd77 commented Nov 12, 2022

Thanks for the report. It seems it did not work before.

@smemsh
Copy link
Contributor Author

smemsh commented Nov 12, 2022

That works, thanks. Now if only this worked:

bind "main" "z" = "set ui.show_title_bar = 1"

but it seems that cannot be done. Is there a way to bind exmode/config statement to key?

@rkd77
Copy link
Owner

rkd77 commented Nov 13, 2022

Not yet. I've got an idea:
config string options macro.0 to macro.9. Eg.
set macro.0 = "set ui.show_title_bar = 0"
set macro.1 = "set ui.show_title_bar = 1"

and actions:
macro-0
macro-1
and so on.

and finally
bind "main" "z" = "macro-0"
bind "main" "Z" = "macro-1"

In code macro-0 will eval macro.0.

It can be done with minimal changes in code. Some problems can occur with double quotes in double quotes, but it can be addressed later.
If there is no objections, I'll implement it this week.

rkd77 added a commit that referenced this issue Nov 13, 2022
…#196

They can be bind to keys. For example

set macro.0 = "set ui.show_title_bar = 0"
set macro.1 = "set ui.show_title_bar = 1"
bind "main" "z" = "macro-0"
bind "main" "Z" = "macro-1"
@rkd77
Copy link
Owner

rkd77 commented Nov 13, 2022

Maybe too soon, but committed. Try it, please.

@smemsh
Copy link
Contributor Author

smemsh commented Nov 15, 2022

is this the right syntax?

set macro.0 = "set ui.show_title_bar = 0"
set macro.1 = "set ui.show_title_bar = 1"
bind "main" "z" = "macro-0"
bind "main" "Z" = "macro-1"

set macro.2 = "set ui.show_status_bar = 0"
set macro.3 = "set ui.show_status_bar = 1"
bind "main" "s" = "macro-2"
bind "main" "S" = "macro-3"

set macro.4 = "set ui.date_format = \"%b %e %H:%M\""
set macro.5 = "set ui.date_format = \"%Y%m%d%H%M%S\""
bind "main" "d" = "macro-4"
bind "main" "D" = "macro-5"

none of them seem to change status or title bar (I'll move to dates once those work...) however they are seen in keybind manager (the mapping to macro is shown, but macro definition is not seen anywhere in options or keybinds, at least using search function, maybe it doesn't show up though). nothing happens when any of the keys are pressed. there are no parse errors on start.

rkd77 added a commit that referenced this issue Nov 15, 2022
@rkd77
Copy link
Owner

rkd77 commented Nov 15, 2022

Macros are visible in options manager as a separate category.
ui.date_format is shown for example in cookies dialog. ui.clock.format is for clock.
When ui.leds.enable is 0, changes require pressing addional key,

@smemsh
Copy link
Contributor Author

smemsh commented Nov 22, 2022

I see now, the page needs redraw action for new setting to take effect. This means it is not equivalent to manual entry, as redraw is not required to affect change upon manual entry at exmode prompt. A compound statement terminator character could solve this, or allowing multiple values, to be evaluated in sequence, such as:

bind "main" "z" = "macro-0" "redraw"

rkd77 added a commit that referenced this issue Nov 22, 2022
For example:
set macro.0 = "set ui.show_title_bar = 0;set ui.show_status_bar = 0;redraw"
@rkd77
Copy link
Owner

rkd77 commented Nov 22, 2022

If did not make mistake, semicolon is delimiter for commands in macros.

@smemsh
Copy link
Contributor Author

smemsh commented Nov 23, 2022

awesome, can we add this to allow spaces after semi?

--- a/src/dialogs/exmode.c
+++ b/src/dialogs/exmode.c
@@ -132,6 +132,7 @@ try_exmode_exec(struct session *ses, const char *val)
        while (1) {
                char *command, *args;
 
+               while (*next && isspace((unsigned char)(*next))) next++;
                command = args = next;
 
                while (*command == ':') command++;

@rkd77
Copy link
Owner

rkd77 commented Nov 23, 2022

@smemsh , added. Thanks.

@smemsh
Copy link
Contributor Author

smemsh commented Nov 23, 2022

everything works great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants