diff --git a/CMakeLists.txt b/CMakeLists.txt index 37c58c18..3d214807 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.6.0) -project(win-vind VERSION 5.7.0) +project(win-vind VERSION 5.8.0) set(INTERNAL_VERSION ${PROJECT_VERSION}.0) if(NOT CMAKE_BUILD_TYPE) diff --git a/docs/cheat_sheet/defaults/big/index.md b/docs/cheat_sheet/defaults/big/index.md index 88f17d4c..19b1bfd8 100644 --- a/docs/cheat_sheet/defaults/big/index.md +++ b/docs/cheat_sheet/defaults/big/index.md @@ -19,13 +19,13 @@ nav: Big Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| |`V`|[\]({{ site.url }}/cheat_sheet/functions/#select_all)| -|`yy`, `y`, `Y`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_copy)| -|`P`, `p`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_paste)| -|`dd`, `D`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_cut)| +|`Y`, `y`, `yy`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_copy)| +|`p`, `P`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_paste)| +|`D`, `dd`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_cut)| |`x`, ``|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_delete)| |`X`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_backspace)| |``|[\]({{ site.url }}/cheat_sheet/functions/#redo)| -|`u`, `U`|[\]({{ site.url }}/cheat_sheet/functions/#undo)| +|`U`, `u`|[\]({{ site.url }}/cheat_sheet/functions/#undo)| |`h`|[\]({{ site.url }}/cheat_sheet/functions/#switch_to_left_vdesktop)| |`l`|[\]({{ site.url }}/cheat_sheet/functions/#switch_to_right_vdesktop)| |`n`|[\]({{ site.url }}/cheat_sheet/functions/#create_new_vdesktop)| @@ -44,24 +44,24 @@ nav: Big Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| +|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| |``|[\]({{ site.url }}/cheat_sheet/functions/#to_resident)| ### Mouse Movement |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``, `h`|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_left)| -|`l`, ``, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_right)| -|`-`, `k`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_up)| -|`+`, `j`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_down)| +|``, ``, `h`|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_left)| +|``, `l`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_right)| +|`k`, `-`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_up)| +|`+`, ``, `j`|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_down)| ### Mouse Jumping |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`0`, `^`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_left)| -|`$`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_right)| +|`^`, `0`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_left)| +|``, `$`|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_right)| |`gg`|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_top)| |`G`|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_bottom)| |`gm`|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_hcenter)| @@ -71,13 +71,13 @@ nav: Big Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up)| +|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up)| |``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up_halfpage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down_halfpage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up_onepage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down_onepage)| -|`zh`, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left)| +|``, `zh`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left)| |``, `zl`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_right)| |`zH`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left_halfpage)| |`zL`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_right_halfpage)| @@ -86,9 +86,9 @@ nav: Big Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`yy`, `y`, `Y`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_copy)| -|`P`, `p`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_paste)| -|`dd`, `D`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_cut)| +|`Y`, `y`, `yy`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_copy)| +|`p`, `P`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_paste)| +|`D`, `dd`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_cut)| |`x`, ``|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_delete)| |`X`|[\]({{ site.url }}/cheat_sheet/functions/#hotkey_backspace)| @@ -107,14 +107,14 @@ nav: Big Mappings |`vdprev`|[\]({{ site.url }}/cheat_sheet/functions/#switch_to_left_vdesktop)| |`vdnext`|[\]({{ site.url }}/cheat_sheet/functions/#switch_to_right_vdesktop)| |`closev`|[\]({{ site.url }}/cheat_sheet/functions/#close_current_vdesktop)| -|`tv`, `vdesktoplist`, `taskview`|[\]({{ site.url }}/cheat_sheet/functions/#taskview)| +|`tv`, `taskview`, `vdesktoplist`|[\]({{ site.url }}/cheat_sheet/functions/#taskview)| |`tabprevious`|[\]({{ site.url }}/cheat_sheet/functions/#switch_to_left_tab)| |`tabnext`|[\]({{ site.url }}/cheat_sheet/functions/#switch_to_right_tab)| |`tabnew`|[\]({{ site.url }}/cheat_sheet/functions/#open_new_tab)| -|`q`, `q!`, `tabclose`|[\]({{ site.url }}/cheat_sheet/functions/#close_current_tab)| +|`q!`, `q`, `tabclose`|[\]({{ site.url }}/cheat_sheet/functions/#close_current_tab)| |`ex`, `explorer`|[\]({{ site.url }}/cheat_sheet/functions/#start_explorer)| |`win`, `start`|[\]({{ site.url }}/cheat_sheet/functions/#open_startmenu)| -|`find`, `open`|[\]({{ site.url }}/cheat_sheet/functions/#open)| +|`open`, `find`|[\]({{ site.url }}/cheat_sheet/functions/#open)| |`forward`|[\]({{ site.url }}/cheat_sheet/functions/#forward_ui_navigation)| |`backward`|[\]({{ site.url }}/cheat_sheet/functions/#backward_ui_navigation)| |`decide`|[\]({{ site.url }}/cheat_sheet/functions/#decide_focused_ui_object)| diff --git a/docs/cheat_sheet/defaults/huge/index.md b/docs/cheat_sheet/defaults/huge/index.md index 6fbaaf39..3d7ce6e1 100644 --- a/docs/cheat_sheet/defaults/huge/index.md +++ b/docs/cheat_sheet/defaults/huge/index.md @@ -10,7 +10,7 @@ nav: Huge Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`mkdir`, `md`|[\]({{ site.url }}/cheat_sheet/functions/#makedir)| +|`md`, `mkdir`|[\]({{ site.url }}/cheat_sheet/functions/#makedir)|

diff --git a/docs/cheat_sheet/defaults/normal/index.md b/docs/cheat_sheet/defaults/normal/index.md index c3aec4c4..5a249667 100644 --- a/docs/cheat_sheet/defaults/normal/index.md +++ b/docs/cheat_sheet/defaults/normal/index.md @@ -10,7 +10,7 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``, `I`|[\]({{ site.url }}/cheat_sheet/functions/#click_left)[\]({{ site.url }}/cheat_sheet/functions/#to_edi_normal)| +|`I`, ``, ``|[\]({{ site.url }}/cheat_sheet/functions/#click_left)[\]({{ site.url }}/cheat_sheet/functions/#to_edi_normal)| ## Editor Normal Mode @@ -18,7 +18,7 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| +|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| |``|[\]({{ site.url }}/cheat_sheet/functions/#to_resident)| |`:`|[\]({{ site.url }}/cheat_sheet/functions/#to_command)| |`i`|[\]({{ site.url }}/cheat_sheet/functions/#to_insert)| @@ -29,13 +29,13 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up)| +|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up)| |``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up_halfpage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down_halfpage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up_onepage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down_onepage)| -|`zh`, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left)| +|``, `zh`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left)| |``, `zl`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_right)| |`zH`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left_halfpage)| |`zL`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_right_halfpage)| @@ -45,7 +45,7 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| |``|[\]({{ site.url }}/cheat_sheet/functions/#redo)| -|`u`, `U`|[\]({{ site.url }}/cheat_sheet/functions/#undo)| +|`U`, `u`|[\]({{ site.url }}/cheat_sheet/functions/#undo)| |`gT`|[\]({{ site.url }}/cheat_sheet/functions/#switch_to_left_tab)| |`gt`|[\]({{ site.url }}/cheat_sheet/functions/#switch_to_right_tab)| |`/`, `?`|[\]({{ site.url }}/cheat_sheet/functions/#search_pattern)| @@ -54,7 +54,7 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`gI`, `I`|[\]({{ site.url }}/cheat_sheet/functions/#to_insert_bol)| +|`I`, `gI`|[\]({{ site.url }}/cheat_sheet/functions/#to_insert_bol)| |`a`|[\]({{ site.url }}/cheat_sheet/functions/#to_insert_append)| |`A`|[\]({{ site.url }}/cheat_sheet/functions/#to_insert_eol)| |`o`|[\]({{ site.url }}/cheat_sheet/functions/#to_insert_nlbelow)| @@ -64,10 +64,10 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``, ``, `h`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_left)| -|`l`, ``, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_right)| -|``, `-`, `gk`, ``, `k`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_up)| -|`j`, ``, ``, ``, `gj`, ``, `+`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_down)| +|``, ``, ``, `h`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_left)| +|``, `l`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_right)| +|`k`, ``, `gk`, ``, `-`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_up)| +|``, ``, `gj`, `j`, ``, `+`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_down)| |`w`|[\]({{ site.url }}/cheat_sheet/functions/#move_fwd_word)| |`b`|[\]({{ site.url }}/cheat_sheet/functions/#move_bck_word)| |`W`|[\]({{ site.url }}/cheat_sheet/functions/#move_fwd_bigword)| @@ -81,8 +81,8 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`0`, `g0`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_bol)| -|`$`, `g$`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_eol)| +|`g0`, `0`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_bol)| +|``, `g$`, `$`|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_eol)| |`gg`|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_bof)| |`G`|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_eof)| @@ -90,7 +90,7 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`yy`, `Y`|[\]({{ site.url }}/cheat_sheet/functions/#yank_line)| +|`Y`, `yy`|[\]({{ site.url }}/cheat_sheet/functions/#yank_line)| |`y`|[\]({{ site.url }}/cheat_sheet/functions/#yank_with_motion)| |`p`|[\]({{ site.url }}/cheat_sheet/functions/#put_after)| |`P`|[\]({{ site.url }}/cheat_sheet/functions/#put_before)| @@ -115,7 +115,7 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| +|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| |``|[\]({{ site.url }}/cheat_sheet/functions/#to_resident)| |`:`|[\]({{ site.url }}/cheat_sheet/functions/#to_command)| |``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_edi_normal)| @@ -124,13 +124,13 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up)| +|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up)| |``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up_halfpage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down_halfpage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up_onepage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down_onepage)| -|`zh`, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left)| +|``, `zh`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left)| |``, `zl`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_right)| |`zH`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left_halfpage)| |`zL`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_right_halfpage)| @@ -139,10 +139,10 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``, ``, `h`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_left)| -|`l`, ``, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_right)| -|``, `-`, `gk`, ``, `k`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_up)| -|`j`, ``, ``, ``, `gj`, ``, `+`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_down)| +|``, ``, ``, `h`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_left)| +|``, `l`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_right)| +|`k`, ``, `gk`, ``, `-`|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_up)| +|``, ``, `gj`, `j`, ``, `+`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_caret_down)| |`w`|[\]({{ site.url }}/cheat_sheet/functions/#move_fwd_word_simple)| |`b`|[\]({{ site.url }}/cheat_sheet/functions/#move_bck_word_simple)| @@ -150,8 +150,8 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`0`, `g0`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_bol)| -|`$`, `g$`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_eol)| +|`g0`, `0`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_bol)| +|``, `g$`, `$`|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_eol)| |`gg`|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_bof)| |`G`|[\]({{ site.url }}/cheat_sheet/functions/#jump_caret_to_eof)| @@ -160,8 +160,8 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| |`y`|[\]({{ site.url }}/cheat_sheet/functions/#yank_highlight_text)| -|`x`, `X`, `d`|[\]({{ site.url }}/cheat_sheet/functions/#delete_highlight_text)| -|`S`, `c`, `s`|[\]({{ site.url }}/cheat_sheet/functions/#change_highlight_text)| +|`X`, `x`, `d`|[\]({{ site.url }}/cheat_sheet/functions/#delete_highlight_text)| +|`c`, `S`, `s`|[\]({{ site.url }}/cheat_sheet/functions/#change_highlight_text)| ## Insert Mode @@ -179,9 +179,9 @@ nav: Normal Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`edinormal`, `en`|[\]({{ site.url }}/cheat_sheet/functions/#to_edi_normal)| -|`ev`, `edivisual`|[\]({{ site.url }}/cheat_sheet/functions/#to_edi_visual)| -|`evl`, `edivisualline`|[\]({{ site.url }}/cheat_sheet/functions/#to_edi_visual_line)| +|`en`, `edinormal`|[\]({{ site.url }}/cheat_sheet/functions/#to_edi_normal)| +|`edivisual`, `ev`|[\]({{ site.url }}/cheat_sheet/functions/#to_edi_visual)| +|`edivisualline`, `evl`|[\]({{ site.url }}/cheat_sheet/functions/#to_edi_visual_line)| ### Shortcut diff --git a/docs/cheat_sheet/defaults/small/index.md b/docs/cheat_sheet/defaults/small/index.md index 00c1836a..0a0af507 100644 --- a/docs/cheat_sheet/defaults/small/index.md +++ b/docs/cheat_sheet/defaults/small/index.md @@ -13,7 +13,7 @@ nav: Small Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| |`n`|[\]({{ site.url }}/cheat_sheet/functions/#open_new_window)| -|`q`, `c`|[\]({{ site.url }}/cheat_sheet/functions/#close_current_window)| +|`c`, `q`|[\]({{ site.url }}/cheat_sheet/functions/#close_current_window)| ### Window Select @@ -48,8 +48,8 @@ nav: Small Mappings |`-`|[\]({{ site.url }}/cheat_sheet/functions/#decrease_window_height)| |`u`|[\]({{ site.url }}/cheat_sheet/functions/#maximize_current_window)| |`d`|[\]({{ site.url }}/cheat_sheet/functions/#minimize_current_window)| -|``, `H`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_left)| -|`L`, ``|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_right)| +|`H`, ``|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_left)| +|``, `L`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_right)| |`K`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_top)| |`J`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_bottom)| |`e`|[\]({{ site.url }}/cheat_sheet/functions/#window_resizer)| @@ -60,10 +60,10 @@ nav: Small Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`close`, `cl`|[\]({{ site.url }}/cheat_sheet/functions/#close_current_window)| +|`cl`, `close`|[\]({{ site.url }}/cheat_sheet/functions/#close_current_window)| |`new`|[\]({{ site.url }}/cheat_sheet/functions/#open_new_window)| -|`sp`, `split`|[\]({{ site.url }}/cheat_sheet/functions/#open_new_window_with_hsplit)| -|`vs`, `vsplit`|[\]({{ site.url }}/cheat_sheet/functions/#open_new_window_with_vsplit)| +|`split`, `sp`|[\]({{ site.url }}/cheat_sheet/functions/#open_new_window_with_hsplit)| +|`vsplit`, `vs`|[\]({{ site.url }}/cheat_sheet/functions/#open_new_window_with_vsplit)| ### Window Select @@ -75,20 +75,20 @@ nav: Small Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`resizer`, `winresizer`|[\]({{ site.url }}/cheat_sheet/functions/#window_resizer)| -|`only`, `max`, `on`|[\]({{ site.url }}/cheat_sheet/functions/#maximize_current_window)| -|`hi`, `hide`, `min`|[\]({{ site.url }}/cheat_sheet/functions/#minimize_current_window)| +|`winresizer`, `resizer`|[\]({{ site.url }}/cheat_sheet/functions/#window_resizer)| +|`max`, `on`, `only`|[\]({{ site.url }}/cheat_sheet/functions/#maximize_current_window)| +|`min`, `hide`, `hi`|[\]({{ site.url }}/cheat_sheet/functions/#minimize_current_window)| |`lsplit`, `lsp`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_left)| -|`rsp`, `rsplit`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_right)| +|`rsplit`, `rsp`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_right)| |`tsp`, `tsplit`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_top)| -|`bsp`, `bsplit`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_bottom)| +|`bsplit`, `bsp`|[\]({{ site.url }}/cheat_sheet/functions/#snap_current_window_to_bottom)| |`arrange`|[\]({{ site.url }}/cheat_sheet/functions/#arrange_windows)| |`reload`|[\]({{ site.url }}/cheat_sheet/functions/#reload_current_window)| -|`rot`, `rotate`|[\]({{ site.url }}/cheat_sheet/functions/#rotate_windows)| +|`rotate`, `rot`|[\]({{ site.url }}/cheat_sheet/functions/#rotate_windows)| |`rerotate`, `rerot`|[\]({{ site.url }}/cheat_sheet/functions/#rotate_windows_in_reverse)| |`exchange`|[\]({{ site.url }}/cheat_sheet/functions/#exchange_window_with_nearest)| |`vertres`, `verticalresize`|[\]({{ site.url }}/cheat_sheet/functions/#resize_window_width)| -|`verticalresize+`, `vertres+`|[\]({{ site.url }}/cheat_sheet/functions/#increase_window_width)| +|`vertres+`, `verticalresize+`|[\]({{ site.url }}/cheat_sheet/functions/#increase_window_width)| |`verticalresize-`, `vertres-`|[\]({{ site.url }}/cheat_sheet/functions/#decrease_window_width)| |`res`, `resize`|[\]({{ site.url }}/cheat_sheet/functions/#resize_window_height)| |`resize+`, `res+`|[\]({{ site.url }}/cheat_sheet/functions/#increase_window_height)| @@ -99,8 +99,8 @@ nav: Small Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| |`!`|[\]({{ site.url }}/cheat_sheet/functions/#start_external)| -|`edit`, `execute`, `e`|[\]({{ site.url }}/cheat_sheet/functions/#execute)| -|`term`, `shell`, `terminal`, `sh`|[\]({{ site.url }}/cheat_sheet/functions/#start_shell)| +|`e`, `execute`, `edit`|[\]({{ site.url }}/cheat_sheet/functions/#execute)| +|`terminal`, `term`, `sh`, `shell`|[\]({{ site.url }}/cheat_sheet/functions/#start_shell)|

diff --git a/docs/cheat_sheet/defaults/tiny/index.md b/docs/cheat_sheet/defaults/tiny/index.md index 895cce87..9f56d085 100644 --- a/docs/cheat_sheet/defaults/tiny/index.md +++ b/docs/cheat_sheet/defaults/tiny/index.md @@ -12,7 +12,7 @@ nav: Tiny Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| +|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| |``|[\]({{ site.url }}/cheat_sheet/functions/#to_resident)| |`:`|[\]({{ site.url }}/cheat_sheet/functions/#to_command)| |`i`|[\]({{ site.url }}/cheat_sheet/functions/#click_left)[\]({{ site.url }}/cheat_sheet/functions/#to_insert)| @@ -21,9 +21,9 @@ nav: Tiny Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, `h`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_left)| -|`l`, ``, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_right)| -|`-`, `k`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_up)| +|``, ``, `h`|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_left)| +|``, `l`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_right)| +|`k`, `-`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_up)| |`+`, `j`, ``|[\]({{ site.url }}/cheat_sheet/functions/#move_cursor_down)| ### Mouse Clicking @@ -37,14 +37,14 @@ nav: Tiny Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up)| +|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up)| |``, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up_halfpage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down_halfpage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_up_onepage)| |``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_down_onepage)| -|`zh`, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left)| -|`zl`, ``|[\]({{ site.url }}/cheat_sheet/functions/#scroll_right)| +|``, `zh`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left)| +|``, `zl`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_right)| |`zh`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_left_halfpage)| |`zl`|[\]({{ site.url }}/cheat_sheet/functions/#scroll_right_halfpage)| @@ -52,8 +52,8 @@ nav: Tiny Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|`0`, `^`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_left)| -|`$`, ``|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_right)| +|`^`, ``, `0`|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_left)| +|``, `$`|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_right)| |`gg`|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_top)| |`G`|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_bottom)| |`gm`|[\]({{ site.url }}/cheat_sheet/functions/#jump_cursor_to_hcenter)| @@ -69,8 +69,9 @@ nav: Tiny Mappings |`Fa`|[\]({{ site.url }}/cheat_sheet/functions/#easyclick)[\]({{ site.url }}/cheat_sheet/functions/#click_right)| |`Fm`|[\]({{ site.url }}/cheat_sheet/functions/#easyclick)[\]({{ site.url }}/cheat_sheet/functions/#click_mid)| |`Fh`|[\]({{ site.url }}/cheat_sheet/functions/#easyclick)| +|`Ft`|[\]({{ site.url }}/cheat_sheet/functions/#focus_textarea)| |``|[\]({{ site.url }}/cheat_sheet/functions/#gridmove)| -|`AA`, `Ao`|[\]({{ site.url }}/cheat_sheet/functions/#easyclick_all)[\]({{ site.url }}/cheat_sheet/functions/#click_left)| +|`Ao`, `AA`|[\]({{ site.url }}/cheat_sheet/functions/#easyclick_all)[\]({{ site.url }}/cheat_sheet/functions/#click_left)| |`Aa`|[\]({{ site.url }}/cheat_sheet/functions/#easyclick_all)[\]({{ site.url }}/cheat_sheet/functions/#click_right)| |`Am`|[\]({{ site.url }}/cheat_sheet/functions/#easyclick_all)[\]({{ site.url }}/cheat_sheet/functions/#click_mid)| |`Ah`|[\]({{ site.url }}/cheat_sheet/functions/#easyclick_all)| @@ -79,7 +80,7 @@ nav: Tiny Mappings |**Trigger Commands**|**Called Commands**| |:---:|:---:| -|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| +|``, ``|[\]({{ site.url }}/cheat_sheet/functions/#to_gui_normal)| |``|[\]({{ site.url }}/cheat_sheet/functions/#to_instant_gui_normal)| |``|[\]({{ site.url }}/cheat_sheet/functions/#to_resident)| @@ -113,9 +114,9 @@ nav: Tiny Mappings |`{mode}unmap`|[\<{mode}unmap\>]({{ site.url }}/cheat_sheet/functions/#unmap)| |`{mode}mapclear`|[\<{mode}mapclear\>]({{ site.url }}/cheat_sheet/functions/#mapclear)| |`command`, `com`|[\]({{ site.url }}/cheat_sheet/functions/#command)| -|`delc`, `delcommand`|[\]({{ site.url }}/cheat_sheet/functions/#delcommand)| +|`delcommand`, `delc`|[\]({{ site.url }}/cheat_sheet/functions/#delcommand)| |`comclear`, `comc`|[\]({{ site.url }}/cheat_sheet/functions/#comclear)| -|`so`, `source`|[\]({{ site.url }}/cheat_sheet/functions/#source)| +|`source`, `so`|[\]({{ site.url }}/cheat_sheet/functions/#source)| |`autocmd`|[\]({{ site.url }}/cheat_sheet/functions/#autocmd_add)| |`autocmd!`|[\]({{ site.url }}/cheat_sheet/functions/#autocmd_del)| diff --git a/docs/cheat_sheet/functions/index.md b/docs/cheat_sheet/functions/index.md index 3ca11936..b7ebd47b 100644 --- a/docs/cheat_sheet/functions/index.md +++ b/docs/cheat_sheet/functions/index.md @@ -496,6 +496,21 @@ In order to change the grid size, set the size with `gridmove_size` option. It a
+ +### **``** +Select the text area closest to the cursor and move the mouse cursor over it. +If there are multiple text areas, the selection is based on the minimum Euclidean distance between the mouse cursor and the center point of the bounding box of the text area. + +In the previous version of win-vind, this function was attached to the Editor Normal Mode as the `autofocus_textarea` option, but it is now independent. Currently, the `autofocus_textarea` option is deprecated. For compatibility, `autofocus_textarea` defines a mapping such as `autocmd EdiNormalEnter * `. + +

+ +

Focus the nearest text area and move the cursor.

+

+ +
+ + ### **``** Jump the mouse cursor to the left. diff --git a/docs/cheat_sheet/options/index.md b/docs/cheat_sheet/options/index.md index 2701a0e1..c5911c8e 100644 --- a/docs/cheat_sheet/options/index.md +++ b/docs/cheat_sheet/options/index.md @@ -292,12 +292,6 @@ Width of block style caret on solid mode ## AutoFocus -### **`autofocus_textarea`** -**type**: bool, **default**: false -Automatically focus on the nearest text area when switching to **Editor Normal Mode** - -
- ### **`autotrack_popup`** **type**: bool, **default**: false It is one of standard options on Windows. For example, if shown **Are you sure you want to move this file to the Recycle Bin?**, it automatically moves the cursor to the popup window. @@ -307,7 +301,7 @@ It is one of standard options on Windows. For example, if shown **Are you sure y ### **`uiacachebuild`** **type**: bool, **default**: false -EasyClick and `autofocus_textarea` are slow because they scan the UI object after being called. If this option is enabled, scanning is done asynchronously and cache is used as a result. Using the cache is 30 times faster than scanning linearly, but the location information, etc. may not always be correct. +[easyclick](../functions/#easyclick) and [focus_textarea](../functions/#focus_textarea) are slow because they scan the UI object after being called. If this option is enabled, scanning is done asynchronously and cache is used as a result. Using the cache is 30 times faster than scanning linearly, but the location information, etc. may not always be correct.
diff --git a/docs/imgs/focus_textarea.png b/docs/imgs/focus_textarea.png new file mode 100644 index 00000000..24978bbf Binary files /dev/null and b/docs/imgs/focus_textarea.png differ diff --git a/res/resources/defaults/tiny.vindrc b/res/resources/defaults/tiny.vindrc index 354bae33..f10606bd 100644 --- a/res/resources/defaults/tiny.vindrc +++ b/res/resources/defaults/tiny.vindrc @@ -61,6 +61,7 @@ gnnoremap Fo gnnoremap Fa gnnoremap Fm gnnoremap Fh +gnnoremap Ft gnnoremap gnnoremap AA diff --git a/src/bind/bindinglist.cpp b/src/bind/bindinglist.cpp index 29353727..f8aadc87 100644 --- a/src/bind/bindinglist.cpp +++ b/src/bind/bindinglist.cpp @@ -27,6 +27,7 @@ #include "mouse/click.hpp" #include "mouse/easyclick.hpp" +#include "mouse/focustextarea.hpp" #include "mouse/gridmove.hpp" #include "mouse/jump_actwin.hpp" #include "mouse/jump_cursor.hpp" @@ -110,6 +111,7 @@ namespace vind ExitConfigGUI::create(), Exit::create(), Sleep::create(), + FocusTextArea::create(), ForwardUINavigation::create(), GotoNextPage::create(), GotoPrevPage::create(), diff --git a/src/bind/mode/change_mode.cpp b/src/bind/mode/change_mode.cpp index 5dd89853..3e9f44c4 100644 --- a/src/bind/mode/change_mode.cpp +++ b/src/bind/mode/change_mode.cpp @@ -9,7 +9,6 @@ #include "core/settable.hpp" #include "opt/uiacachebuild.hpp" #include "opt/vcmdline.hpp" -#include "options.hpp" #include "util/debug.hpp" #include "util/def.hpp" #include "util/mouse.hpp" @@ -102,16 +101,10 @@ namespace vind ac.apply(core::get_enter_event(core::Mode::GUI_VISUAL)) ; } - // All instances share TextAreaScanner to keep staticity of sprocess. - TextAreaScanner ToEdiNormal::scanner_ ; - //ToEdiNormal ToEdiNormal::ToEdiNormal() : BindedFuncVoid("to_edi_normal") - { - opt::AsyncUIACacheBuilder::register_properties( - scanner_.get_properties()) ; - } + {} void ToEdiNormal::sprocess( std::uint16_t UNUSED(count), const std::string& UNUSED(args), @@ -138,14 +131,6 @@ namespace vind opt::VCmdLine::print(opt::GeneralMessage("-- EDI NORMAL --")) ; } - auto& settable = core::SetTable::get_instance() ; - if(settable.get("autofocus_textarea").get()) { - if(auto hwnd = util::get_foreground_window()) { - auto pos = util::get_cursor_pos() ; - focus_nearest_textarea(hwnd, pos, scanner_) ; - } - } - ac.apply(core::get_enter_event(Mode::EDI_NORMAL)) ; } diff --git a/src/bind/mode/change_mode.hpp b/src/bind/mode/change_mode.hpp index 35f71d08..480bc288 100644 --- a/src/bind/mode/change_mode.hpp +++ b/src/bind/mode/change_mode.hpp @@ -2,7 +2,6 @@ #define _CHANGE_MODE_HPP #include "bind/bindedfunc.hpp" -#include "text_area_scanner.hpp" namespace vind { @@ -44,11 +43,7 @@ namespace vind } } ; - class ToEdiNormal : public BindedFuncVoid { - private: - static TextAreaScanner scanner_ ; - - public: + struct ToEdiNormal : public BindedFuncVoid { explicit ToEdiNormal() ; static void sprocess( std::uint16_t count, diff --git a/src/bind/mode/options.cpp b/src/bind/mode/options.cpp deleted file mode 100644 index d3d1032b..00000000 --- a/src/bind/mode/options.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "options.hpp" - -#include "core/settable.hpp" -#include "opt/uiacachebuild.hpp" -#include "util/box2d.hpp" -#include "util/debug.hpp" -#include "util/def.hpp" -#include "util/rect.hpp" -#include "util/uia.hpp" -#include "util/winwrap.hpp" - -#include - - -#undef max - - -namespace vind -{ - namespace bind - { - void focus_nearest_textarea( - HWND hwnd, - const util::Point2D& point, - TextAreaScanner& instance) { - - std::vector editables{} ; - - auto& settable = core::SetTable::get_instance() ; - if(settable.get("uiacachebuild").get()) { - auto root_elem = opt::AsyncUIACacheBuilder::get_root_element(hwnd) ; - instance.scan(root_elem, editables) ; - } - else { - instance.scan(hwnd, editables) ; - } - - if(editables.empty()) { - return ; - } - - if(editables.size() == 1) { - if(util::is_failed(editables.front()->SetFocus())) { - throw RUNTIME_EXCEPT("SetFocus Failed.") ; - } - return ; - } - - util::SmartElement nearest ; - auto min_distance = std::numeric_limits::max() ; - - for(auto& elem : editables) { - // scan GUI objects only at leaves in tree. - util::Box2D box ; - if(util::is_failed(elem->get_CachedBoundingRectangle(&box.data()))) { - throw RUNTIME_EXCEPT("Could not get the a rectangle of a element.") ; - } - - auto distance = util::l2_distance_nosq( - point.x(), point.y(), - box.center_x(), box.center_y()) / 100 ; - - if(min_distance > distance) { - nearest = elem ; - min_distance = distance ; - } - } - - if(util::is_failed(nearest->SetFocus())) { - throw RUNTIME_EXCEPT("SetFocus Failed.") ; - } - } - } -} diff --git a/src/bind/mode/options.hpp b/src/bind/mode/options.hpp deleted file mode 100644 index 76387d2a..00000000 --- a/src/bind/mode/options.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _OPTIONS_HPP -#define _OPTIONS_HPP - -#include "text_area_scanner.hpp" -#include "util/point2d.hpp" - - -namespace vind -{ - namespace bind - { - void focus_nearest_textarea( - HWND hwnd, - const util::Point2D& point, - TextAreaScanner& instance) ; - - } -} - -#endif diff --git a/src/bind/mode/text_area_scanner.cpp b/src/bind/mode/text_area_scanner.cpp deleted file mode 100644 index 4f6abac3..00000000 --- a/src/bind/mode/text_area_scanner.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "text_area_scanner.hpp" - -#include "core/errlogger.hpp" -#include "util/debug.hpp" -#include "util/def.hpp" -#include "util/winwrap.hpp" - - -namespace vind -{ - namespace bind - { - TextAreaScanner::TextAreaScanner() - : UIWalker{ - UIA_IsTextPatternAvailablePropertyId, - UIA_IsValuePatternAvailablePropertyId, - UIA_HasKeyboardFocusPropertyId, - UIA_ValueIsReadOnlyPropertyId - } - { - UIWalker::enable_fullcontrol() ; - } - - bool TextAreaScanner::pinpoint_element(const util::SmartElement& elem) { - BOOL flag ; - if(util::is_failed(elem->get_CachedHasKeyboardFocus(&flag))) { - throw RUNTIME_EXCEPT("Could not get a cached property value: HasKeyboardFocus.") ; - } - return flag == TRUE ; - } - - bool TextAreaScanner::filter_element(const util::SmartElement& elem) { - VARIANT val ; - - if(util::is_failed(elem->GetCachedPropertyValue( - UIA_ValueIsReadOnlyPropertyId, &val))) { - throw RUNTIME_EXCEPT("Could not get a chached property value: IsReadOnly.") ; - } - if(val.vt != VT_BOOL) { - return false ; - } - if(val.boolVal == VARIANT_TRUE) { - return false ; - } - - if(util::is_failed(elem->GetCachedPropertyValue( - UIA_IsTextPatternAvailablePropertyId, &val))) { - throw RUNTIME_EXCEPT("Could not get a chached property value: IsTextPatternAvailable.") ; - } - if(val.vt != VT_BOOL) { - return false ; - } - if(val.boolVal == VARIANT_FALSE) { - return false ; - } - - if(util::is_failed(elem->GetCachedPropertyValue( - UIA_IsValuePatternAvailablePropertyId, &val))) { - throw RUNTIME_EXCEPT("Could not get a chached property value: IsValuePatternAvailable.") ; - } - if(val.vt != VT_BOOL) { - return false ; - } - if(val.boolVal == VARIANT_FALSE) { - return false ; - } - - return true ; - } - } -} diff --git a/src/bind/mode/text_area_scanner.hpp b/src/bind/mode/text_area_scanner.hpp deleted file mode 100644 index 462f783a..00000000 --- a/src/bind/mode/text_area_scanner.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _BIND_MODE_OPTIONS_HPP -#define _BIND_MODE_OPTIONS_HPP - -#include "util/uiwalker.hpp" - - -namespace vind -{ - namespace bind - { - struct TextAreaScanner : public util::UIWalker { - explicit TextAreaScanner() ; - virtual bool pinpoint_element(const util::SmartElement& elem) override ; - virtual bool filter_element(const util::SmartElement& elem) override ; - } ; - } -} - -#endif diff --git a/src/bind/mouse/focustextarea.cpp b/src/bind/mouse/focustextarea.cpp new file mode 100644 index 00000000..1f4c9213 --- /dev/null +++ b/src/bind/mouse/focustextarea.cpp @@ -0,0 +1,170 @@ +#include "focustextarea.hpp" + +#include "core/errlogger.hpp" +#include "core/settable.hpp" +#include "opt/uiacachebuild.hpp" +#include "util/box2d.hpp" +#include "util/debug.hpp" +#include "util/def.hpp" +#include "util/rect.hpp" +#include "util/uia.hpp" +#include "util/uiwalker.hpp" +#include "util/winwrap.hpp" + +#include + +#undef max + + +namespace +{ + using namespace vind ; + + struct TextAreaScanner : public util::UIWalker { + explicit TextAreaScanner() + : UIWalker{ + UIA_IsTextPatternAvailablePropertyId, + UIA_IsValuePatternAvailablePropertyId, + UIA_HasKeyboardFocusPropertyId, + UIA_ValueIsReadOnlyPropertyId + } + { + UIWalker::enable_fullcontrol() ; + } + + virtual bool pinpoint_element(const util::SmartElement& elem) override { + BOOL flag ; + if(util::is_failed(elem->get_CachedHasKeyboardFocus(&flag))) { + throw RUNTIME_EXCEPT("Could not get a cached property value: HasKeyboardFocus.") ; + } + return flag == TRUE ; + } + + virtual bool filter_element(const util::SmartElement& elem) override { + VARIANT val ; + + if(util::is_failed(elem->GetCachedPropertyValue( + UIA_ValueIsReadOnlyPropertyId, &val))) { + throw RUNTIME_EXCEPT("Could not get a chached property value: IsReadOnly.") ; + } + if(val.vt != VT_BOOL) { + return false ; + } + if(val.boolVal == VARIANT_TRUE) { + return false ; + } + + if(util::is_failed(elem->GetCachedPropertyValue( + UIA_IsTextPatternAvailablePropertyId, &val))) { + throw RUNTIME_EXCEPT("Could not get a chached property value: IsTextPatternAvailable.") ; + } + if(val.vt != VT_BOOL) { + return false ; + } + if(val.boolVal == VARIANT_FALSE) { + return false ; + } + + if(util::is_failed(elem->GetCachedPropertyValue( + UIA_IsValuePatternAvailablePropertyId, &val))) { + throw RUNTIME_EXCEPT("Could not get a chached property value: IsValuePatternAvailable.") ; + } + if(val.vt != VT_BOOL) { + return false ; + } + if(val.boolVal == VARIANT_FALSE) { + return false ; + } + + return true ; + } + } ; +} + + +namespace vind +{ + namespace bind + { + struct FocusTextArea::Impl { + TextAreaScanner scanner_{} ; + + void focus_nearest_textarea( + HWND hwnd, + const util::Point2D& point) { + + std::vector editables{} ; + + auto& settable = core::SetTable::get_instance() ; + if(settable.get("uiacachebuild").get()) { + auto root_elem = opt::AsyncUIACacheBuilder::get_root_element(hwnd) ; + scanner_.scan(root_elem, editables) ; + } + else { + scanner_.scan(hwnd, editables) ; + } + + if(editables.empty()) { + return ; + } + + if(editables.size() == 1) { + if(util::is_failed(editables.front()->SetFocus())) { + throw RUNTIME_EXCEPT("SetFocus Failed.") ; + } + return ; + } + + util::SmartElement nearest ; + util::Box2D nearest_box ; + auto min_distance = std::numeric_limits::max() ; + + for(auto& elem : editables) { + // scan GUI objects only at leaves in tree. + util::Box2D box ; + if(util::is_failed(elem->get_CachedBoundingRectangle(&box.data()))) { + throw RUNTIME_EXCEPT("Could not get the a rectangle of a element.") ; + } + + auto distance = util::l2_distance_nosq( + point.x(), point.y(), + box.center_x(), box.center_y()) / 100 ; + + if(min_distance > distance) { + nearest = elem ; + min_distance = distance ; + nearest_box = box ; + } + } + + if(util::is_failed(nearest->SetFocus())) { + throw RUNTIME_EXCEPT("SetFocus Failed.") ; + } + + // Move the cursor into the text area. + util::set_cursor_pos(nearest_box.center_x(), nearest_box.center_y()) ; + } + } ; + + FocusTextArea::FocusTextArea() + : BindedFuncVoid("focus_textarea"), + pimpl(std::make_unique()) + { + opt::AsyncUIACacheBuilder::register_properties( + pimpl->scanner_.get_properties()) ; + } + + FocusTextArea::~FocusTextArea() noexcept = default ; + FocusTextArea::FocusTextArea(FocusTextArea&&) = default ; + FocusTextArea& FocusTextArea::operator=(FocusTextArea&&) = default ; + + void FocusTextArea::sprocess( + std::uint16_t UNUSED(count), + const std::string& UNUSED(args)) { + if(auto hwnd = util::get_foreground_window()) { + auto pos = util::get_cursor_pos() ; + pimpl->focus_nearest_textarea(hwnd, pos) ; + } + } + } +} diff --git a/src/bind/mouse/focustextarea.hpp b/src/bind/mouse/focustextarea.hpp new file mode 100644 index 00000000..2609f7c7 --- /dev/null +++ b/src/bind/mouse/focustextarea.hpp @@ -0,0 +1,33 @@ +#ifndef _FOCUSTEXTAREA_HPP +#define _FOCUSTEXTAREA_HPP + +#include "bind/bindedfunc.hpp" + +#include + + +namespace vind +{ + namespace bind + { + class FocusTextArea : public BindedFuncVoid { + private: + struct Impl ; + std::unique_ptr pimpl ; + + public: + explicit FocusTextArea() ; + virtual ~FocusTextArea() noexcept ; + + void sprocess( + std::uint16_t count, const std::string& args) ; + + FocusTextArea(FocusTextArea&&) ; + FocusTextArea& operator=(FocusTextArea&&) ; + FocusTextArea(const FocusTextArea&) = delete ; + FocusTextArea& operator=(const FocusTextArea&) = delete ; + } ; + } +} + +#endif diff --git a/src/bind/syscmd/source.cpp b/src/bind/syscmd/source.cpp index 5e923eb7..7d94065c 100644 --- a/src/bind/syscmd/source.cpp +++ b/src/bind/syscmd/source.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -85,7 +86,7 @@ namespace return target_repo_path / ".vindrc" ; } - std::string to_compatible(std::string text) { + void to_compatible(std::string& cmd, std::string& args) { std::vector> compatible { {"system_command_comclear", "comclear"}, {"system_command_command", "command"}, @@ -116,9 +117,17 @@ namespace {"", ""}, } ; for(auto& [from, to] : compatible) { - text = util::replace_all(text, from, to) ; + args = util::replace_all(args, from, to) ; + } + + if(args.find("noautofocus_textarea") != std::string::npos) { + cmd.clear() ; + args.clear() ; + } + else if(args.find("autofocus_textarea") != std::string::npos) { + cmd = "autocmd" ; + args = "EdiNormalEnter * " ; } - return text ; } void do_runcommand( @@ -266,7 +275,10 @@ namespace vind } cmd = util::A2a(cmd) ; - line_args = to_compatible(line_args) ; + to_compatible(cmd, line_args) ; + if(cmd.empty()) { + continue ; + } if(!loaded_default_) { loaded_default_ = true ; diff --git a/src/core/settable.cpp b/src/core/settable.cpp index a8bf4dc2..9294692f 100644 --- a/src/core/settable.cpp +++ b/src/core/settable.cpp @@ -13,7 +13,6 @@ namespace Param("arrangewin_ignore", ""), - Param("autofocus_textarea", false), Param("autotrack_popup", false), Param("blockstylecaret", false), diff --git a/src/core/version.hpp b/src/core/version.hpp index df49308d..dbff3470 100644 --- a/src/core/version.hpp +++ b/src/core/version.hpp @@ -1,6 +1,6 @@ #ifndef _VERSION_HPP #define _VERSION_HPP -#define WIN_VIND_VERSION "5.6.0.1" +#define WIN_VIND_VERSION "5.7.0.0" #endif