diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-05-16 15:33:44 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-05-16 15:33:44 +0200 |
commit | e3e20f2b60972bcaa845d1000fe615498dd2cef5 (patch) | |
tree | f6ee65eeaa3d5a9b0f9694c10b7ad538870d0da0 /src/core | |
parent | bd1db541f782c8ec9a5545bb9ba7f49870c43574 (diff) | |
download | weechat-e3e20f2b60972bcaa845d1000fe615498dd2cef5.zip |
core: add horizontal scrolling for buffers with free content (command /window scroll_horiz) (task #11112)
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-command.c | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 224d44cb6..64463c4d4 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -4364,6 +4364,25 @@ COMMAND_CALLBACK(window) return WEECHAT_RC_OK; } + /* vertical scroll in window */ + if (string_strcasecmp (argv[1], "scroll") == 0) + { + if (argc > 2) + gui_window_scroll (gui_current_window, argv[2]); + return WEECHAT_RC_OK; + } + + /* horizontal scroll in window (for buffers with free content) */ + if (string_strcasecmp (argv[1], "scroll_horiz") == 0) + { + if ((argc > 2) + && (gui_current_window->buffer->type == GUI_BUFFER_TYPE_FREE)) + { + gui_window_scroll_horiz (gui_current_window, argv[2]); + } + return WEECHAT_RC_OK; + } + /* scroll up current window */ if (string_strcasecmp (argv[1], "scroll_up") == 0) { @@ -4517,18 +4536,6 @@ COMMAND_CALLBACK(window) return WEECHAT_RC_OK; } - /* jump to window by buffer number */ - if (string_strncasecmp (argv[1], "b", 1) == 0) - { - error = NULL; - number = strtol (argv[1] + 1, &error, 10); - if (error && !error[0]) - { - gui_window_switch_by_buffer (gui_current_window, number); - return WEECHAT_RC_OK; - } - } - /* switch to previous window */ if (string_strcasecmp (argv[1], "-1") == 0) { @@ -4571,14 +4578,6 @@ COMMAND_CALLBACK(window) return WEECHAT_RC_OK; } - /* scroll in window */ - if (string_strcasecmp (argv[1], "scroll") == 0) - { - if (argc > 2) - gui_window_scroll (gui_current_window, argv[2]); - return WEECHAT_RC_OK; - } - /* swap windows */ if (string_strcasecmp (argv[1], "swap") == 0) { @@ -4616,6 +4615,18 @@ COMMAND_CALLBACK(window) return WEECHAT_RC_OK; } + /* jump to window by buffer number */ + if (string_strncasecmp (argv[1], "b", 1) == 0) + { + error = NULL; + number = strtol (argv[1] + 1, &error, 10); + if (error && !error[0]) + { + gui_window_switch_by_buffer (gui_current_window, number); + return WEECHAT_RC_OK; + } + } + gui_chat_printf (NULL, _("%sError: unknown option for \"%s\" " "command"), @@ -5271,7 +5282,9 @@ command_init () " || merge [all]" " || page_up|page_down" " || refresh" - " || scroll|scroll_up|scroll_down|scroll_top|" + " || scroll [+/-]<value>[s|m|h|d|M|y]" + " || scroll_horiz [+/-]<value>[%]" + " || scroll_up|scroll_down|scroll_top|" "scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight" " || swap [up|down|left|right]" @@ -5295,8 +5308,11 @@ command_init () " page_up: scroll one page up\n" " page_down: scroll one page down\n" " refresh: refresh screen\n" - " scroll: scroll number of lines (+/-N) or with time: " + " scroll: scroll a number of lines (+/-N) or with time: " "s=seconds, m=minutes, h=hours, d=days, M=months, y=years\n" + " scroll_horiz: scroll horizontally a number of columns " + "(+/-N) or percentage of window size (this scrolling is " + "possible only on buffers with free content)\n" " scroll_up: scroll a few lines up\n" " scroll_down: scroll a few lines down\n" " scroll_top: scroll to top of buffer\n" @@ -5321,8 +5337,8 @@ command_init () " /window scroll -d"), "list || -1 || +1 || up || down || left || right" " || splith || splitv || resize || balance || page_up" - " || page_down || refresh || scroll || scroll_up" - " || scroll_down || scroll_top || scroll_bottom" + " || page_down || refresh || scroll || scroll_horiz" + " || scroll_up || scroll_down || scroll_top || scroll_bottom" " || scroll_previous_highlight || scroll_next_highlight" " || swap up|down|left|right || zoom || merge all", &command_window, NULL); |