From 48e6a1e387e0853e84632e13f77b093ac439081b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 16 Aug 2023 15:25:52 +0200 Subject: [PATCH] core: add parameters and key bindings to move to edges of current area with commands `/cursor go` and `/cursor move` (closes #1282) --- ChangeLog.adoc | 1 + ReleaseNotes.adoc | 22 +++++ doc/de/weechat_user.de.adoc | 50 ++++++---- doc/en/weechat_user.en.adoc | 44 +++++---- doc/fr/weechat_user.fr.adoc | 44 +++++---- doc/it/weechat_user.it.adoc | 50 ++++++---- doc/ja/weechat_user.ja.adoc | 50 ++++++---- doc/pl/weechat_user.pl.adoc | 50 ++++++---- doc/sr/weechat_user.sr.adoc | 50 ++++++---- src/core/wee-command.c | 32 +++++- src/gui/curses/gui-curses-key.c | 24 +++-- src/gui/gui-cursor.c | 169 ++++++++++++++++++++++++++++---- src/gui/gui-cursor.h | 3 +- 13 files changed, 424 insertions(+), 165 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index a1fec841e..722c2f620 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -16,6 +16,7 @@ For a list of important changes that require manual actions, please look at rele New features:: * core: add option type "enum" (issue #1973) + * core: add parameters and key bindings to move to edges of current area with commands `/cursor go` and `/cursor move` (issue #1282) * core: add variables "_chat_focused_line_bol" and "_chat_focused_line_eol" in focus data (issue #1955) * api: add info "buffer" (issue #1962) * buflist: increase max number of buflist items from 3 to 5 (issue #1703) diff --git a/ReleaseNotes.adoc b/ReleaseNotes.adoc index 7500faa10..70bf1acd3 100644 --- a/ReleaseNotes.adoc +++ b/ReleaseNotes.adoc @@ -14,6 +14,28 @@ For a complete list of changes, please look at ChangeLog. [[v4.1.0]] == Version 4.1.0 (under dev) +[[v4.1.0_cursor_mode_keys]] +=== New keys to move in cursor mode + +New keys have been added to move in cursor mode, and existing keys to move to +another area have been changed: modifier is now kbd:[Alt+Shift] instead of +kbd:[Alt]. + +You can change existing keys and add new ones with these commands: + +---- +/key bindctxt cursor meta-up /cursor move edge_top +/key bindctxt cursor meta-down /cursor move edge_bottom +/key bindctxt cursor meta-left /cursor move edge_left +/key bindctxt cursor meta-right /cursor move edge_right +/key bindctxt cursor meta-end /cursor move bottom_right +/key bindctxt cursor meta-home /cursor move top_left +/key bindctxt cursor meta-shift-up /cursor move area_up +/key bindctxt cursor meta-shift-down /cursor move area_down +/key bindctxt cursor meta-shift-left /cursor move area_left +/key bindctxt cursor meta-shift-right /cursor move area_right +---- + [[v4.1.0_irc_ctcp_replies]] === IRC CTCP replies diff --git a/doc/de/weechat_user.de.adoc b/doc/de/weechat_user.de.adoc index e6ea94b9b..9669fe634 100644 --- a/doc/de/weechat_user.de.adoc +++ b/doc/de/weechat_user.de.adoc @@ -1682,27 +1682,39 @@ Diese Tasten werden im Kontext "cursor" verwendet (Cursor kann frei auf dem Bild [width="100%",cols="^.^3,^.^2,.^7,.^7",options="header"] |=== -| Taste | Bereich | Beschreibung | Befehl -| kbd:[↑] | - | bewegt Cursor eine Zeile nach oben. | `+/cursor move up+` -| kbd:[↓] | - | bewegt Cursor eine Zeile nach unten. | `+/cursor move down+` -| kbd:[←] | - | bewegt Cursor eine Spalte nach links. | `+/cursor move left+` -| kbd:[→] | - | bewegt Cursor eine Spalte nach rechts. | `+/cursor move right+` -| kbd:[Alt+↑] | - | bewegt Cursor einen Bereich nach oben. | `+/cursor move area_up+` -| kbd:[Alt+↓] | - | bewegt Cursor einen Bereich nach unten. | `+/cursor move area_down+` -| kbd:[Alt+←] | - | bewegt Cursor einen Bereich nach links. | `+/cursor move area_left+` -| kbd:[Alt+→] | - | bewegt Cursor einen Bereich nach rechts. | `+/cursor move area_right+` -| kbd:[m] | Chat | zitiert Nachricht. | `+hsignal:chat_quote_message;/cursor stop+` -| kbd:[l] | Chat | zitiert aktuelle Zeile. | `+hsignal:chat_quote_focused_line;/cursor stop+` -| kbd:[q] | Chat | zitiert prefix + Nachricht. | `+hsignal:chat_quote_prefix_message;/cursor stop+` -| kbd:[Q] | Chat | zitiert Uhrzeit + prefix + Nachricht. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` -| kbd:[b] | Benutzerliste | verbannt nick (Ban). | `+/window ${_window_number};/ban ${nick}+` -| kbd:[k] | Benutzerliste | kickt nick. | `+/window ${_window_number};/kick ${nick}+` -| kbd:[K] | Benutzerliste | kickt und verbannt nick. | `+/window ${_window_number};/kickban ${nick}+` -| kbd:[q] | Benutzerliste | öffnet privaten Chat mit Nick. | `+/window ${_window_number};/query ${nick};/cursor stop+` -| kbd:[w] | Benutzerliste | führt einen whois für Nick aus. | `+/window ${_window_number};/whois ${nick}+` +| Taste | Bereich | Beschreibung | Befehl +| kbd:[↑] | - | bewegt Cursor eine Zeile nach oben. | `+/cursor move up+` +| kbd:[↓] | - | bewegt Cursor eine Zeile nach unten. | `+/cursor move down+` +| kbd:[←] | - | bewegt Cursor eine Spalte nach links. | `+/cursor move left+` +| kbd:[→] | - | bewegt Cursor eine Spalte nach rechts. | `+/cursor move right+` +// TRANSLATION MISSING +| kbd:[Alt+↑] | - | Move cursor to the first line of the area. | `+/cursor move edge_top+` +// TRANSLATION MISSING +| kbd:[Alt+↓] | - | Move cursor to the last line of the area. | `+/cursor move edge_bottom+` +// TRANSLATION MISSING +| kbd:[Alt+←] | - | Move cursor to the first column of the area. | `+/cursor move edge_left+` +// TRANSLATION MISSING +| kbd:[Alt+→] | - | Move cursor to the last column of the area. | `+/cursor move edge_right+` +// TRANSLATION MISSING +| kbd:[Alt+Home] | - | Move cursor to the top left corner of the area. | `+/cursor move top_left+` +// TRANSLATION MISSING +| kbd:[Alt+End] | - | Move cursor to the bottom right corner of the area. | `+/cursor move bottom_right+` +| kbd:[Alt+Shift+↑] | - | bewegt Cursor einen Bereich nach oben. | `+/cursor move area_up+` +| kbd:[Alt+Shift+↓] | - | bewegt Cursor einen Bereich nach unten. | `+/cursor move area_down+` +| kbd:[Alt+Shift+←] | - | bewegt Cursor einen Bereich nach links. | `+/cursor move area_left+` +| kbd:[Alt+Shift+→] | - | bewegt Cursor einen Bereich nach rechts. | `+/cursor move area_right+` +| kbd:[m] | Chat | zitiert Nachricht. | `+hsignal:chat_quote_message;/cursor stop+` +| kbd:[l] | Chat | zitiert aktuelle Zeile. | `+hsignal:chat_quote_focused_line;/cursor stop+` +| kbd:[q] | Chat | zitiert prefix + Nachricht. | `+hsignal:chat_quote_prefix_message;/cursor stop+` +| kbd:[Q] | Chat | zitiert Uhrzeit + prefix + Nachricht. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` +| kbd:[b] | Benutzerliste | verbannt nick (Ban). | `+/window ${_window_number};/ban ${nick}+` +| kbd:[k] | Benutzerliste | kickt nick. | `+/window ${_window_number};/kick ${nick}+` +| kbd:[K] | Benutzerliste | kickt und verbannt nick. | `+/window ${_window_number};/kickban ${nick}+` +| kbd:[q] | Benutzerliste | öffnet privaten Chat mit Nick. | `+/window ${_window_number};/query ${nick};/cursor stop+` +| kbd:[w] | Benutzerliste | führt einen whois für Nick aus. | `+/window ${_window_number};/whois ${nick}+` | kbd:[Enter] + kbd:[Ctrl+j] + - kbd:[Ctrl+m] | - | beendet den Cursor-Modus. | `+/cursor stop+` + kbd:[Ctrl+m] | - | beendet den Cursor-Modus. | `+/cursor stop+` |=== [[key_bindings_mouse]] diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc index cd9d1cf1b..9698627f9 100644 --- a/doc/en/weechat_user.en.adoc +++ b/doc/en/weechat_user.en.adoc @@ -1666,27 +1666,33 @@ These keys are used in context "cursor" (free movement of cursor on screen). [width="100%",cols="^.^3,^.^2,.^7,.^7",options="header"] |=== -| Key | Area | Description | Command -| kbd:[↑] | - | Move cursor one line up. | `+/cursor move up+` -| kbd:[↓] | - | Move cursor one line down. | `+/cursor move down+` -| kbd:[←] | - | Move cursor one column left. | `+/cursor move left+` -| kbd:[→] | - | Move cursor one column right. | `+/cursor move right+` -| kbd:[Alt+↑] | - | Move cursor one area up. | `+/cursor move area_up+` -| kbd:[Alt+↓] | - | Move cursor one area down. | `+/cursor move area_down+` -| kbd:[Alt+←] | - | Move cursor one area left. | `+/cursor move area_left+` -| kbd:[Alt+→] | - | Move cursor one area right. | `+/cursor move area_right+` -| kbd:[m] | chat | Quote message. | `+hsignal:chat_quote_message;/cursor stop+` -| kbd:[l] | chat | Quote focused line. | `+hsignal:chat_quote_focused_line;/cursor stop+` -| kbd:[q] | chat | Quote prefix + message. | `+hsignal:chat_quote_prefix_message;/cursor stop+` -| kbd:[Q] | chat | Quote time + prefix + message. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` -| kbd:[b] | nicklist | Ban nick. | `+/window ${_window_number};/ban ${nick}+` -| kbd:[k] | nicklist | Kick nick. | `+/window ${_window_number};/kick ${nick}+` -| kbd:[K] | nicklist | Kick and ban nick. | `+/window ${_window_number};/kickban ${nick}+` -| kbd:[q] | nicklist | Open query with nick. | `+/window ${_window_number};/query ${nick};/cursor stop+` -| kbd:[w] | nicklist | Do a whois on nick. | `+/window ${_window_number};/whois ${nick}+` +| Key | Area | Description | Command +| kbd:[↑] | - | Move cursor one line up. | `+/cursor move up+` +| kbd:[↓] | - | Move cursor one line down. | `+/cursor move down+` +| kbd:[←] | - | Move cursor one column left. | `+/cursor move left+` +| kbd:[→] | - | Move cursor one column right. | `+/cursor move right+` +| kbd:[Alt+↑] | - | Move cursor to the first line of the area. | `+/cursor move edge_top+` +| kbd:[Alt+↓] | - | Move cursor to the last line of the area. | `+/cursor move edge_bottom+` +| kbd:[Alt+←] | - | Move cursor to the first column of the area. | `+/cursor move edge_left+` +| kbd:[Alt+→] | - | Move cursor to the last column of the area. | `+/cursor move edge_right+` +| kbd:[Alt+Home] | - | Move cursor to the top left corner of the area. | `+/cursor move top_left+` +| kbd:[Alt+End] | - | Move cursor to the bottom right corner of the area. | `+/cursor move bottom_right+` +| kbd:[Alt+Shift+↑] | - | Move cursor one area up. | `+/cursor move area_up+` +| kbd:[Alt+Shift+↓] | - | Move cursor one area down. | `+/cursor move area_down+` +| kbd:[Alt+Shift+←] | - | Move cursor one area left. | `+/cursor move area_left+` +| kbd:[Alt+Shift+→] | - | Move cursor one area right. | `+/cursor move area_right+` +| kbd:[m] | chat | Quote message. | `+hsignal:chat_quote_message;/cursor stop+` +| kbd:[l] | chat | Quote focused line. | `+hsignal:chat_quote_focused_line;/cursor stop+` +| kbd:[q] | chat | Quote prefix + message. | `+hsignal:chat_quote_prefix_message;/cursor stop+` +| kbd:[Q] | chat | Quote time + prefix + message. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` +| kbd:[b] | nicklist | Ban nick. | `+/window ${_window_number};/ban ${nick}+` +| kbd:[k] | nicklist | Kick nick. | `+/window ${_window_number};/kick ${nick}+` +| kbd:[K] | nicklist | Kick and ban nick. | `+/window ${_window_number};/kickban ${nick}+` +| kbd:[q] | nicklist | Open query with nick. | `+/window ${_window_number};/query ${nick};/cursor stop+` +| kbd:[w] | nicklist | Do a whois on nick. | `+/window ${_window_number};/whois ${nick}+` | kbd:[Enter] + kbd:[Ctrl+j] + - kbd:[Ctrl+m] | - | Stop cursor mode | `/cursor stop` + kbd:[Ctrl+m] | - | Stop cursor mode | `/cursor stop` |=== [[key_bindings_mouse]] diff --git a/doc/fr/weechat_user.fr.adoc b/doc/fr/weechat_user.fr.adoc index 55a0a39f6..15e7c4a3c 100644 --- a/doc/fr/weechat_user.fr.adoc +++ b/doc/fr/weechat_user.fr.adoc @@ -1702,27 +1702,33 @@ Ces touches sont utilisées dans le contexte "cursor" (mouvement libre du curseu [width="100%",cols="^.^3,^.^2,.^7,.^7",options="header"] |=== -| Touche | Zone | Description | Commande -| kbd:[↑] | - | Déplacer le curseur d'une ligne vers le haut. | `+/cursor move up+` -| kbd:[↓] | - | Déplacer le curseur d'une ligne vers le bas. | `+/cursor move down+` -| kbd:[←] | - | Déplacer le curseur d'une colonne vers la gauche. | `+/cursor move left+` -| kbd:[→] | - | Déplacer le curseur d'une colonne vers la droite. | `+/cursor move right+` -| kbd:[Alt+↑] | - | Déplacer le curseur vers la zone au dessus. | `+/cursor move area_up+` -| kbd:[Alt+↓] | - | Déplacer le curseur vers la zone en dessous. | `+/cursor move area_down+` -| kbd:[Alt+←] | - | Déplacer le curseur vers la zone sur la gauche. | `+/cursor move area_left+` -| kbd:[Alt+→] | - | Déplacer le curseur vers la zone sur la droite. | `+/cursor move area_right+` -| kbd:[m] | chat | Citer le message. | `+hsignal:chat_quote_message;/cursor stop+` -| kbd:[l] | chat | Citer la ligne ciblée. | `+hsignal:chat_quote_focused_line;/cursor stop+` -| kbd:[q] | chat | Citer le préfixe + le message. | `+hsignal:chat_quote_prefix_message;/cursor stop+` -| kbd:[Q] | chat | Citer l'heure + le préfixe + le message. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` -| kbd:[b] | liste des pseudos | Bannir le pseudo. | `+/window ${_window_number};/ban ${nick}+` -| kbd:[k] | liste des pseudos | Retirer par la force le pseudo. | `+/window ${_window_number};/kick ${nick}+` -| kbd:[K] | liste des pseudos | Retirer par la force et bannir le pseudo. | `+/window ${_window_number};/kickban ${nick}+` -| kbd:[q] | liste des pseudos | Ouvrir une discussion avec le pseudo. | `+/window ${_window_number};/query ${nick};/cursor stop+` -| kbd:[w] | liste des pseudos | Effectuer un whois sur le pseudo. | `+/window ${_window_number};/whois ${nick}+` +| Touche | Zone | Description | Commande +| kbd:[↑] | - | Déplacer le curseur d'une ligne vers le haut. | `+/cursor move up+` +| kbd:[↓] | - | Déplacer le curseur d'une ligne vers le bas. | `+/cursor move down+` +| kbd:[←] | - | Déplacer le curseur d'une colonne vers la gauche. | `+/cursor move left+` +| kbd:[→] | - | Déplacer le curseur d'une colonne vers la droite. | `+/cursor move right+` +| kbd:[Alt+↑] | - | Déplacer le curseur vers la première ligne de la zone. | `+/cursor move edge_top+` +| kbd:[Alt+↓] | - | Déplacer le curseur vers la dernière ligne de la zone. | `+/cursor move edge_bottom+` +| kbd:[Alt+←] | - | Déplacer le curseur vers la première colonne de la zone. | `+/cursor move edge_left+` +| kbd:[Alt+→] | - | Déplacer le curseur vers la dernière colonne de la zone. | `+/cursor move edge_right+` +| kbd:[Alt+Home] | - | Déplacer le curseur vers le coin supérieur gauche de la zone. | `+/cursor move top_left+` +| kbd:[Alt+End] | - | Déplacer le curseur vers la coin inférieur droit de la zone. | `+/cursor move bottom_right+` +| kbd:[Alt+Shift+↑] | - | Déplacer le curseur vers la zone au dessus. | `+/cursor move area_up+` +| kbd:[Alt+Shift+↓] | - | Déplacer le curseur vers la zone en dessous. | `+/cursor move area_down+` +| kbd:[Alt+Shift+←] | - | Déplacer le curseur vers la zone sur la gauche. | `+/cursor move area_left+` +| kbd:[Alt+Shift+→] | - | Déplacer le curseur vers la zone sur la droite. | `+/cursor move area_right+` +| kbd:[m] | chat | Citer le message. | `+hsignal:chat_quote_message;/cursor stop+` +| kbd:[l] | chat | Citer la ligne ciblée. | `+hsignal:chat_quote_focused_line;/cursor stop+` +| kbd:[q] | chat | Citer le préfixe + le message. | `+hsignal:chat_quote_prefix_message;/cursor stop+` +| kbd:[Q] | chat | Citer l'heure + le préfixe + le message. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` +| kbd:[b] | liste des pseudos | Bannir le pseudo. | `+/window ${_window_number};/ban ${nick}+` +| kbd:[k] | liste des pseudos | Retirer par la force le pseudo. | `+/window ${_window_number};/kick ${nick}+` +| kbd:[K] | liste des pseudos | Retirer par la force et bannir le pseudo. | `+/window ${_window_number};/kickban ${nick}+` +| kbd:[q] | liste des pseudos | Ouvrir une discussion avec le pseudo. | `+/window ${_window_number};/query ${nick};/cursor stop+` +| kbd:[w] | liste des pseudos | Effectuer un whois sur le pseudo. | `+/window ${_window_number};/whois ${nick}+` | kbd:[Enter] + kbd:[Ctrl+j] + - kbd:[Ctrl+m] | - | Arrêter le mode curseur ("cursor"). | `+/cursor stop+` + kbd:[Ctrl+m] | - | Arrêter le mode curseur ("cursor"). | `+/cursor stop+` |=== [[key_bindings_mouse]] diff --git a/doc/it/weechat_user.it.adoc b/doc/it/weechat_user.it.adoc index 68ab7ef0a..8993c3333 100644 --- a/doc/it/weechat_user.it.adoc +++ b/doc/it/weechat_user.it.adoc @@ -1838,28 +1838,40 @@ sullo schermo. [width="100%",cols="^.^3,^.^2,.^7,.^7",options="header"] |=== -| Tasto | Zona | Descrizione | Comando -| kbd:[↑] | - | Sposta il cursore di una riga in alto. | `+/cursor move up+` -| kbd:[↓] | - | Sposta il cursore di una riga in basso. | `+/cursor move down+` -| kbd:[←] | - | Sposta il cursore di una colonna a sinistra. | `+/cursor move left+` -| kbd:[→] | - | Sposta il cursore di una colonna a destra. | `+/cursor move right+` -| kbd:[Alt+↑] | - | Sposta il cursore nell'area in alto. | `+/cursor move area_up+` -| kbd:[Alt+↓] | - | Sposta il cursore nell'area in basso. | `+/cursor move area_down+` -| kbd:[Alt+←] | - | Sposta il cursore nell'area a sinistra. | `+/cursor move area_left+` -| kbd:[Alt+→] | - | Sposta il cursore nell'area a destra. | `+/cursor move area_right+` -| kbd:[m] | chat | Cita messaggio. | `+hsignal:chat_quote_message;/cursor stop+` +| Tasto | Zona | Descrizione | Comando +| kbd:[↑] | - | Sposta il cursore di una riga in alto. | `+/cursor move up+` +| kbd:[↓] | - | Sposta il cursore di una riga in basso. | `+/cursor move down+` +| kbd:[←] | - | Sposta il cursore di una colonna a sinistra. | `+/cursor move left+` +| kbd:[→] | - | Sposta il cursore di una colonna a destra. | `+/cursor move right+` // TRANSLATION MISSING -| kbd:[l] | chat | Quote focused line. | `+hsignal:chat_quote_focused_line;/cursor stop+` -| kbd:[q] | chat | Cita prefisso + messaggio. | `+hsignal:chat_quote_prefix_message;/cursor stop+` -| kbd:[Q] | chat | Cita ora + prefisso + messaggio. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` -| kbd:[b] | lista nick | Ban di un nick. | `+/window ${_window_number};/ban ${nick}+` -| kbd:[k] | lista nick | Kick di un nick. | `+/window ${_window_number};/kick ${nick}+` -| kbd:[K] | lista nick | Kick e ban di un nick. | `+/window ${_window_number};/kickban ${nick}+` -| kbd:[q] | lista nick | Apri query con il nick. | `+/window ${_window_number};/query ${nick};/cursor stop+` -| kbd:[w] | lista nick | Effettua un whois sul nick. | `+/window ${_window_number};/whois ${nick}+` +| kbd:[Alt+↑] | - | Move cursor to the first line of the area. | `+/cursor move edge_top+` +// TRANSLATION MISSING +| kbd:[Alt+↓] | - | Move cursor to the last line of the area. | `+/cursor move edge_bottom+` +// TRANSLATION MISSING +| kbd:[Alt+←] | - | Move cursor to the first column of the area. | `+/cursor move edge_left+` +// TRANSLATION MISSING +| kbd:[Alt+→] | - | Move cursor to the last column of the area. | `+/cursor move edge_right+` +// TRANSLATION MISSING +| kbd:[Alt+Home] | - | Move cursor to the top left corner of the area. | `+/cursor move top_left+` +// TRANSLATION MISSING +| kbd:[Alt+End] | - | Move cursor to the bottom right corner of the area. | `+/cursor move bottom_right+` +| kbd:[Alt+Shift+↑] | - | Sposta il cursore nell'area in alto. | `+/cursor move area_up+` +| kbd:[Alt+Shift+↓] | - | Sposta il cursore nell'area in basso. | `+/cursor move area_down+` +| kbd:[Alt+Shift+←] | - | Sposta il cursore nell'area a sinistra. | `+/cursor move area_left+` +| kbd:[Alt+Shift+→] | - | Sposta il cursore nell'area a destra. | `+/cursor move area_right+` +| kbd:[m] | chat | Cita messaggio. | `+hsignal:chat_quote_message;/cursor stop+` +// TRANSLATION MISSING +| kbd:[l] | chat | Quote focused line. | `+hsignal:chat_quote_focused_line;/cursor stop+` +| kbd:[q] | chat | Cita prefisso + messaggio. | `+hsignal:chat_quote_prefix_message;/cursor stop+` +| kbd:[Q] | chat | Cita ora + prefisso + messaggio. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` +| kbd:[b] | lista nick | Ban di un nick. | `+/window ${_window_number};/ban ${nick}+` +| kbd:[k] | lista nick | Kick di un nick. | `+/window ${_window_number};/kick ${nick}+` +| kbd:[K] | lista nick | Kick e ban di un nick. | `+/window ${_window_number};/kickban ${nick}+` +| kbd:[q] | lista nick | Apri query con il nick. | `+/window ${_window_number};/query ${nick};/cursor stop+` +| kbd:[w] | lista nick | Effettua un whois sul nick. | `+/window ${_window_number};/whois ${nick}+` | kbd:[Enter] + kbd:[Ctrl+j] + - kbd:[Ctrl+m] | - | Ferma la modalità cursore. | `+/cursor stop+` + kbd:[Ctrl+m] | - | Ferma la modalità cursore. | `+/cursor stop+` |=== // TRANSLATION MISSING diff --git a/doc/ja/weechat_user.ja.adoc b/doc/ja/weechat_user.ja.adoc index a4675849c..ea6ce25cd 100644 --- a/doc/ja/weechat_user.ja.adoc +++ b/doc/ja/weechat_user.ja.adoc @@ -1782,28 +1782,40 @@ kbd:[Ctrl+r] が押された状態) でのみ有効です。 [width="100%",cols="^.^3,^.^2,.^7,.^7",options="header"] |=== -| キー | エリア | 説明 | コマンド -| kbd:[↑] | - | カーソルを上の行に移動 | `+/cursor move up+` -| kbd:[↓] | - | カーソルを下の行に移動 | `+/cursor move down+` -| kbd:[←] | - | カーソルを左の列に移動 | `+/cursor move left+` -| kbd:[→] | - | カーソルを右の列に移動 | `+/cursor move right+` -| kbd:[Alt+↑] | - | カーソルを上のエリアに移動 | `+/cursor move area_up+` -| kbd:[Alt+↓] | - | カーソルを下のエリアに移動 | `+/cursor move area_down+` -| kbd:[Alt+←] | - | カーソルを左のエリアに移動 | `+/cursor move area_left+` -| kbd:[Alt+→] | - | カーソルを右のエリアに移動 | `+/cursor move area_right+` -| kbd:[m] | チャット | メッセージを引用 | `+hsignal:chat_quote_message;/cursor stop+` +| キー | エリア | 説明 | コマンド +| kbd:[↑] | - | カーソルを上の行に移動 | `+/cursor move up+` +| kbd:[↓] | - | カーソルを下の行に移動 | `+/cursor move down+` +| kbd:[←] | - | カーソルを左の列に移動 | `+/cursor move left+` +| kbd:[→] | - | カーソルを右の列に移動 | `+/cursor move right+` // TRANSLATION MISSING -| kbd:[l] | チャット | Quote focused line. | `+hsignal:chat_quote_focused_line;/cursor stop+` -| kbd:[q] | チャット | プレフィックスとメッセージを引用 | `+hsignal:chat_quote_prefix_message;/cursor stop+` -| kbd:[Q] | チャット | 時間、プレフィックス、メッセージを引用 | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` -| kbd:[b] | ニックネームリスト| ニックネームをバンする | `+/window ${_window_number};/ban ${nick}+` -| kbd:[k] | ニックネームリスト| ニックネームをキックする | `+/window ${_window_number};/kick ${nick}+` -| kbd:[K] | ニックネームリスト| ニックネームをバンとキックする | `+/window ${_window_number};/kickban ${nick}+` -| kbd:[q] | ニックネームリスト| ニックネームに対するクエリを開く | `+/window ${_window_number};/query ${nick};/cursor stop+` -| kbd:[w] | ニックネームリスト| ニックネームに対して whois を行う | `+/window ${_window_number};/whois ${nick}+` +| kbd:[Alt+↑] | - | Move cursor to the first line of the area. | `+/cursor move edge_top+` +// TRANSLATION MISSING +| kbd:[Alt+↓] | - | Move cursor to the last line of the area. | `+/cursor move edge_bottom+` +// TRANSLATION MISSING +| kbd:[Alt+←] | - | Move cursor to the first column of the area. | `+/cursor move edge_left+` +// TRANSLATION MISSING +| kbd:[Alt+→] | - | Move cursor to the last column of the area. | `+/cursor move edge_right+` +// TRANSLATION MISSING +| kbd:[Alt+Home] | - | Move cursor to the top left corner of the area. | `+/cursor move top_left+` +// TRANSLATION MISSING +| kbd:[Alt+End] | - | Move cursor to the bottom right corner of the area. | `+/cursor move bottom_right+` +| kbd:[Alt+Shift+↑] | - | カーソルを上のエリアに移動 | `+/cursor move area_up+` +| kbd:[Alt+Shift+↓] | - | カーソルを下のエリアに移動 | `+/cursor move area_down+` +| kbd:[Alt+Shift+←] | - | カーソルを左のエリアに移動 | `+/cursor move area_left+` +| kbd:[Alt+Shift+→] | - | カーソルを右のエリアに移動 | `+/cursor move area_right+` +| kbd:[m] | チャット | メッセージを引用 | `+hsignal:chat_quote_message;/cursor stop+` +// TRANSLATION MISSING +| kbd:[l] | チャット | Quote focused line. | `+hsignal:chat_quote_focused_line;/cursor stop+` +| kbd:[q] | チャット | プレフィックスとメッセージを引用 | `+hsignal:chat_quote_prefix_message;/cursor stop+` +| kbd:[Q] | チャット | 時間、プレフィックス、メッセージを引用 | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` +| kbd:[b] | ニックネームリスト | ニックネームをバンする | `+/window ${_window_number};/ban ${nick}+` +| kbd:[k] | ニックネームリスト | ニックネームをキックする | `+/window ${_window_number};/kick ${nick}+` +| kbd:[K] | ニックネームリスト | ニックネームをバンとキックする | `+/window ${_window_number};/kickban ${nick}+` +| kbd:[q] | ニックネームリスト | ニックネームに対するクエリを開く | `+/window ${_window_number};/query ${nick};/cursor stop+` +| kbd:[w] | ニックネームリスト | ニックネームに対して whois を行う | `+/window ${_window_number};/whois ${nick}+` | kbd:[Enter] + kbd:[Ctrl+j] + - kbd:[Ctrl+m] | - | カーソルモードを終了 | `+/cursor stop+` + kbd:[Ctrl+m] | - | カーソルモードを終了 | `+/cursor stop+` |=== // TRANSLATION MISSING diff --git a/doc/pl/weechat_user.pl.adoc b/doc/pl/weechat_user.pl.adoc index cc2b8d38a..a2f17a583 100644 --- a/doc/pl/weechat_user.pl.adoc +++ b/doc/pl/weechat_user.pl.adoc @@ -1676,27 +1676,39 @@ ekranie). [width="100%",cols="^.^3,^.^2,.^7,.^7",options="header"] |=== -| Skrót | Obszar | Opis | Komenda -| kbd:[↑] | - | Przesuń kursor linię wyżej. | `+/cursor move up+` -| kbd:[↓] | - | Przesuń kursor linię niżej. | `+/cursor move down+` -| kbd:[←] | - | Przesuń kursor kolumnę w lewo. | `+/cursor move left+` -| kbd:[→] | - | Przesuń kursor kolumnę w prawo. | `+/cursor move right+` -| kbd:[Alt+↑] | - | Przesuń kursor obszar do góry. | `+/cursor move area_up+` -| kbd:[Alt+↓] | - | Przesuń kursor obszar w dół. | `+/cursor move area_down+` -| kbd:[Alt+←] | - | Przesuń kursor obszar w lewo. | `+/cursor move area_left+` -| kbd:[Alt+→] | - | Przesuń kursor obszar w prawo. | `+/cursor move area_right+` -| kbd:[m] | chat | Cytuj wiadomość. | `+hsignal:chat_quote_message;/cursor stop+` -| kbd:[l] | chat | Cytuj zaznaczoną linię. | `+hsignal:chat_quote_focused_line;/cursor stop+` -| kbd:[q] | chat | Cytuj prefiks i wiadomość. | `+hsignal:chat_quote_prefix_message;/cursor stop+` -| kbd:[Q] | chat | Cytuj czas, prefiks i wiadomość. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` -| kbd:[b] | nicklist | Zbanuj osobę. | `+/window ${_window_number};/ban ${nick}+` -| kbd:[k] | nicklist | Wykop osobę. | `+/window ${_window_number};/kick ${nick}+` -| kbd:[K] | nicklist | Wykop i zbanuj osobę. | `+/window ${_window_number};/kickban ${nick}+` -| kbd:[q] | nicklist | Otwórz rozmowę z osobą. | `+/window ${_window_number};/query ${nick};/cursor stop+` -| kbd:[w] | nicklist | Wykonaj whois dla osoby. | `+/window ${_window_number};/whois ${nick}+` +| Skrót | Obszar | Opis | Komenda +| kbd:[↑] | - | Przesuń kursor linię wyżej. | `+/cursor move up+` +| kbd:[↓] | - | Przesuń kursor linię niżej. | `+/cursor move down+` +| kbd:[←] | - | Przesuń kursor kolumnę w lewo. | `+/cursor move left+` +| kbd:[→] | - | Przesuń kursor kolumnę w prawo. | `+/cursor move right+` +// TRANSLATION MISSING +| kbd:[Alt+↑] | - | Move cursor to the first line of the area. | `+/cursor move edge_top+` +// TRANSLATION MISSING +| kbd:[Alt+↓] | - | Move cursor to the last line of the area. | `+/cursor move edge_bottom+` +// TRANSLATION MISSING +| kbd:[Alt+←] | - | Move cursor to the first column of the area. | `+/cursor move edge_left+` +// TRANSLATION MISSING +| kbd:[Alt+→] | - | Move cursor to the last column of the area. | `+/cursor move edge_right+` +// TRANSLATION MISSING +| kbd:[Alt+Home] | - | Move cursor to the top left corner of the area. | `+/cursor move top_left+` +// TRANSLATION MISSING +| kbd:[Alt+End] | - | Move cursor to the bottom right corner of the area. | `+/cursor move bottom_right+` +| kbd:[Alt+Shift+↑] | - | Przesuń kursor obszar do góry. | `+/cursor move area_up+` +| kbd:[Alt+Shift+↓] | - | Przesuń kursor obszar w dół. | `+/cursor move area_down+` +| kbd:[Alt+Shift+←] | - | Przesuń kursor obszar w lewo. | `+/cursor move area_left+` +| kbd:[Alt+Shift+→] | - | Przesuń kursor obszar w prawo. | `+/cursor move area_right+` +| kbd:[m] | chat | Cytuj wiadomość. | `+hsignal:chat_quote_message;/cursor stop+` +| kbd:[l] | chat | Cytuj zaznaczoną linię. | `+hsignal:chat_quote_focused_line;/cursor stop+` +| kbd:[q] | chat | Cytuj prefiks i wiadomość. | `+hsignal:chat_quote_prefix_message;/cursor stop+` +| kbd:[Q] | chat | Cytuj czas, prefiks i wiadomość. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` +| kbd:[b] | nicklist | Zbanuj osobę. | `+/window ${_window_number};/ban ${nick}+` +| kbd:[k] | nicklist | Wykop osobę. | `+/window ${_window_number};/kick ${nick}+` +| kbd:[K] | nicklist | Wykop i zbanuj osobę. | `+/window ${_window_number};/kickban ${nick}+` +| kbd:[q] | nicklist | Otwórz rozmowę z osobą. | `+/window ${_window_number};/query ${nick};/cursor stop+` +| kbd:[w] | nicklist | Wykonaj whois dla osoby. | `+/window ${_window_number};/whois ${nick}+` | kbd:[Enter] + kbd:[Ctrl+j] + - kbd:[Ctrl+m] | - | Wyłącz tryb kursora. | `/cursor stop` + kbd:[Ctrl+m] | - | Wyłącz tryb kursora. | `/cursor stop` |=== [[key_bindings_mouse]] diff --git a/doc/sr/weechat_user.sr.adoc b/doc/sr/weechat_user.sr.adoc index a2fd271c6..343894e14 100644 --- a/doc/sr/weechat_user.sr.adoc +++ b/doc/sr/weechat_user.sr.adoc @@ -1580,27 +1580,39 @@ WeeChat нуди доста подразумеваних тастерских п [width="100%", cols="^.^3,^.^2,.^7,.^7", options="header"] |=== -| Тастер | Површина | Опис | Команда -| kbd:[↑] | - | Помера курсор једну линију навише. | `+/cursor move up+` -| kbd:[↓] | - | Помера курсор једну линију наниже. | `+/cursor move down+` -| kbd:[←] | - | Помера курсор једну колони у лево. | `+/cursor move left+` -| kbd:[→] | - | Помера курсор једну колону у десно. | `+/cursor move right+` -| kbd:[Alt+↑] | - | Помера курсор једну површину навише. | `+/cursor move area_up+` -| kbd:[Alt+↓] | - | Помера курсор једну површину наниже. | `+/cursor move area_down+` -| kbd:[Alt+←] | - | Помера курсор једну површину у лево. | `+/cursor move area_left+` -| kbd:[Alt+→] | - | Помера курсор једну површину у десно. | `+/cursor move area_right+` -| kbd:[m] | чет | Цитирање поруке. | `+hsignal:chat_quote_message;/cursor stop+` -| kbd:[l] | чет | Цитирање фокусиране линије. | `+hsignal:chat_quote_focused_line;/cursor stop+` -| kbd:[q] | чет | Цитирање префикса + поруке. | `+hsignal:chat_quote_prefix_message;/cursor stop+` -| kbd:[Q] | чет | Цитирање времена + префикса + поруке. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` -| kbd:[b] | листа надимака | Забрањује надимак. | `+/window ${_window_number};/ban ${nick}+` -| kbd:[k] | листа надимака | Избацује надимак. | `+/window ${_window_number};/kick ${nick}+` -| kbd:[K] | листа надимака | Избацује и забрањује надимак. | `+/window ${_window_number};/kickban ${nick}+` -| kbd:[q] | листа надимака | Отвара упит са надимком. | `+/window ${_window_number};/query ${nick};/cursor stop+` -| kbd:[w] | листа надимака | Извршава whois над надимком. | `+/window ${_window_number};/whois ${nick}+` +| Тастер | Површина | Опис | Команда +| kbd:[↑] | - | Помера курсор једну линију навише. | `+/cursor move up+` +| kbd:[↓] | - | Помера курсор једну линију наниже. | `+/cursor move down+` +| kbd:[←] | - | Помера курсор једну колони у лево. | `+/cursor move left+` +| kbd:[→] | - | Помера курсор једну колону у десно. | `+/cursor move right+` +// TRANSLATION MISSING +| kbd:[Alt+↑] | - | Move cursor to the first line of the area. | `+/cursor move edge_top+` +// TRANSLATION MISSING +| kbd:[Alt+↓] | - | Move cursor to the last line of the area. | `+/cursor move edge_bottom+` +// TRANSLATION MISSING +| kbd:[Alt+←] | - | Move cursor to the first column of the area. | `+/cursor move edge_left+` +// TRANSLATION MISSING +| kbd:[Alt+→] | - | Move cursor to the last column of the area. | `+/cursor move edge_right+` +// TRANSLATION MISSING +| kbd:[Alt+Home] | - | Move cursor to the top left corner of the area. | `+/cursor move top_left+` +// TRANSLATION MISSING +| kbd:[Alt+End] | - | Move cursor to the bottom right corner of the area. | `+/cursor move bottom_right+` +| kbd:[Alt+Shift+↑] | - | Помера курсор једну површину навише. | `+/cursor move area_up+` +| kbd:[Alt+Shift+↓] | - | Помера курсор једну површину наниже. | `+/cursor move area_down+` +| kbd:[Alt+Shift+←] | - | Помера курсор једну површину у лево. | `+/cursor move area_left+` +| kbd:[Alt+Shift+→] | - | Помера курсор једну површину у десно. | `+/cursor move area_right+` +| kbd:[m] | чет | Цитирање поруке. | `+hsignal:chat_quote_message;/cursor stop+` +| kbd:[l] | чет | Цитирање фокусиране линије. | `+hsignal:chat_quote_focused_line;/cursor stop+` +| kbd:[q] | чет | Цитирање префикса + поруке. | `+hsignal:chat_quote_prefix_message;/cursor stop+` +| kbd:[Q] | чет | Цитирање времена + префикса + поруке. | `+hsignal:chat_quote_time_prefix_message;/cursor stop+` +| kbd:[b] | листа надимака | Забрањује надимак. | `+/window ${_window_number};/ban ${nick}+` +| kbd:[k] | листа надимака | Избацује надимак. | `+/window ${_window_number};/kick ${nick}+` +| kbd:[K] | листа надимака | Избацује и забрањује надимак. | `+/window ${_window_number};/kickban ${nick}+` +| kbd:[q] | листа надимака | Отвара упит са надимком. | `+/window ${_window_number};/query ${nick};/cursor stop+` +| kbd:[w] | листа надимака | Извршава whois над надимком. | `+/window ${_window_number};/whois ${nick}+` | kbd:[Enter] + kbd:[Ctrl+j] + - kbd:[Ctrl+m] | - | Зауставља режим померања курсора | `/cursor stop` + kbd:[Ctrl+m] | - | Зауставља режим померања курсора | `/cursor stop` |=== [[key_bindings_mouse]] diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 6dd608ad4..4c52518c0 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -1892,7 +1892,10 @@ COMMAND_CALLBACK(cursor) } } else - gui_cursor_move_area (argv[2]); + { + gui_cursor_move_area (argv[2], + (argc > 3) ? argv_eol[3] : NULL); + } } return WEECHAT_RC_OK; } @@ -1917,6 +1920,17 @@ COMMAND_CALLBACK(cursor) gui_cursor_move_area_add_xy (-1, 0); else if (string_strcmp (argv[2], "area_right") == 0) gui_cursor_move_area_add_xy (1, 0); + else if ((string_strcmp (argv[2], "top_left") == 0) + || (string_strcmp (argv[2], "top_right") == 0) + || (string_strcmp (argv[2], "bottom_left") == 0) + || (string_strcmp (argv[2], "bottom_right") == 0) + || (string_strcmp (argv[2], "edge_top") == 0) + || (string_strcmp (argv[2], "edge_bottom") == 0) + || (string_strcmp (argv[2], "edge_left") == 0) + || (string_strcmp (argv[2], "edge_right") == 0)) + { + gui_cursor_move_position (argv[2]); + } } return WEECHAT_RC_OK; } @@ -7911,8 +7925,11 @@ command_init () NULL, "cursor", N_("free movement of cursor on screen to execute actions on specific " "areas of screen"), - N_("go chat||," - " || move up|down|left|right|area_up|area_down|area_left|area_right" + N_("go chat| [top_left|top_right|bottom_left|bottom_right]" + " || go |," + " || move up|down|left|right|" + "edge_top|edge_bottom|edge_left|edge_right|" + "area_up|area_down|area_left|area_right" " || stop"), N_(" go: move cursor to chat area, a bar (using bar name) or " "coordinates \"x,y\"\n" @@ -7942,12 +7959,17 @@ command_init () " enter exit cursor mode\n" "\n" "Examples:\n" + " go to chat (bottom left corner):\n" + " /cursor go chat bottom_left\n" " go to nicklist:\n" " /cursor go nicklist\n" " go to coordinates x=10, y=5:\n" " /cursor go 10,5"), - "go %(cursor_areas)" - " || move up|down|left|right|area_up|area_down|area_left|area_right" + "go %(cursor_areas) top_left|top_right|bottom_left|bottom_right" + " || move up|down|left|right|" + "top_left|top_right|bottom_left|bottom_right|" + "edge_top|edge_bottom|edge_left|edge_right|" + "area_up|area_down|area_left|area_right" " || stop", &command_cursor, NULL, NULL); hook_command ( diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c index 7a62922dd..d1f451c62 100644 --- a/src/gui/curses/gui-curses-key.c +++ b/src/gui/curses/gui-curses-key.c @@ -217,15 +217,21 @@ gui_key_default_bindings (int context, int create_option) else if (context == GUI_KEY_CONTEXT_CURSOR) { /* general & move */ - BIND("return", "/cursor stop"); - BIND("up", "/cursor move up"); - BIND("down", "/cursor move down"); - BIND("left", "/cursor move left"); - BIND("right", "/cursor move right"); - BIND("meta-up", "/cursor move area_up"); - BIND("meta-down", "/cursor move area_down"); - BIND("meta-left", "/cursor move area_left"); - BIND("meta-right","/cursor move area_right"); + BIND("return", "/cursor stop"); + BIND("up", "/cursor move up"); + BIND("down", "/cursor move down"); + BIND("left", "/cursor move left"); + BIND("right", "/cursor move right"); + BIND("meta-up", "/cursor move edge_top"); + BIND("meta-down", "/cursor move edge_bottom"); + BIND("meta-left", "/cursor move edge_left"); + BIND("meta-right", "/cursor move edge_right"); + BIND("meta-home", "/cursor move top_left"); + BIND("meta-end", "/cursor move bottom_right"); + BIND("meta-shift-up", "/cursor move area_up"); + BIND("meta-shift-down", "/cursor move area_down"); + BIND("meta-shift-left", "/cursor move area_left"); + BIND("meta-shift-right", "/cursor move area_right"); /* chat */ BIND("@chat:m", "hsignal:chat_quote_message;/cursor stop"); BIND("@chat:l", "hsignal:chat_quote_focused_line;/cursor stop"); diff --git a/src/gui/gui-cursor.c b/src/gui/gui-cursor.c index aa369ea13..1a11a9e54 100644 --- a/src/gui/gui-cursor.c +++ b/src/gui/gui-cursor.c @@ -202,6 +202,104 @@ gui_cursor_move_add_xy (int add_x, int add_y) gui_window_move_cursor (); } +/* + * Moves cursor to the given position: top_left, top_right, bottom_left or + * bottom_right. + */ + +void +gui_cursor_move_position (const char *position) +{ + struct t_gui_focus_info *focus_info; + int x1, y1, x2, y2, x, y; + + if (!position) + return; + + if (!gui_cursor_mode) + gui_cursor_mode_toggle (); + + x = gui_cursor_x; + y = gui_cursor_y; + + focus_info = gui_focus_get_info (x, y); + if (!focus_info) + return; + + x1 = -1; + y1 = -1; + x2 = -1; + y2 = -1; + + if (focus_info->bar_window) + { + x1 = focus_info->bar_window->x; + y1 = focus_info->bar_window->y; + x2 = x1 + focus_info->bar_window->width - 1; + y2 = y1 + focus_info->bar_window->height - 1; + } + else if (focus_info->chat && focus_info->window) + { + x1 = focus_info->window->win_chat_x; + y1 = focus_info->window->win_chat_y; + x2 = x1 + focus_info->window->win_chat_width - 1; + y2 = y1 + focus_info->window->win_chat_height - 1; + } + + if ((x1 < 0) || (y1 < 0) || (x2 < 0) || (y2 < 0)) + goto end; + + if (strcmp (position, "top_left") == 0) + { + x = x1; + y = y1; + } + else if (strcmp (position, "top_right") == 0) + { + x = x2; + y = y1; + } + else if (strcmp (position, "bottom_left") == 0) + { + x = x1; + y = y2; + } + else if (strcmp (position, "bottom_right") == 0) + { + x = x2; + y = y2; + } + else if (strcmp (position, "edge_top") == 0) + { + y = y1; + } + else if (strcmp (position, "edge_bottom") == 0) + { + y = y2; + } + else if (strcmp (position, "edge_left") == 0) + { + x = x1; + } + else if (strcmp (position, "edge_right") == 0) + { + x = x2; + } + else + { + goto end; + } + + gui_cursor_x = x; + gui_cursor_y = y; + + gui_cursor_display_debug_info (); + gui_window_move_cursor (); + +end: + gui_focus_free_info (focus_info); +} + /* * Moves cursor to another area by adding values to (x,y). */ @@ -286,24 +384,31 @@ gui_cursor_move_area_add_xy (int add_x, int add_y) /* * Moves cursor to another area by name. + * + * Parameter "position" can be "top_left", "top_right", "bottom_left" or + * "bottom_right" (if NULL, top left is the default position). */ void -gui_cursor_move_area (const char *area) +gui_cursor_move_area (const char *area, const char *position) { - int area_found, x, y; + int area_found, x1, y1, x2, y2, x, y; struct t_gui_bar_window *ptr_bar_win; struct t_gui_bar *ptr_bar; area_found = 0; - x = 0; - y = 0; + x1 = 0; + y1 = 0; + x2 = 0; + y2 = 0; if (strcmp (area, "chat") == 0) { area_found = 1; - x = gui_current_window->win_chat_x; - y = gui_current_window->win_chat_y; + x1 = gui_current_window->win_chat_x; + y1 = gui_current_window->win_chat_y; + x2 = x1 + gui_current_window->win_chat_width - 1; + y2 = y1 + gui_current_window->win_chat_height - 1; } else { @@ -313,8 +418,10 @@ gui_cursor_move_area (const char *area) if (strcmp (ptr_bar_win->bar->name, area) == 0) { area_found = 1; - x = ptr_bar_win->x; - y = ptr_bar_win->y; + x1 = ptr_bar_win->x; + y1 = ptr_bar_win->y; + x2 = x1 + ptr_bar_win->width - 1; + y2 = y1 + ptr_bar_win->height - 1; break; } } @@ -325,20 +432,48 @@ gui_cursor_move_area (const char *area) if (ptr_bar->bar_window && (strcmp (ptr_bar->name, area) == 0)) { area_found = 1; - x = ptr_bar->bar_window->x; - y = ptr_bar->bar_window->y; + x1 = ptr_bar->bar_window->x; + y1 = ptr_bar->bar_window->y; + x2 = x1 + ptr_bar->bar_window->width - 1; + y2 = y1 + ptr_bar->bar_window->height - 1; } } } } - if (area_found) + if (!area_found) + return; + + if (!position || (strcmp (position, "top_left") == 0)) { - if (!gui_cursor_mode) - gui_cursor_mode_toggle (); - gui_cursor_x = x; - gui_cursor_y = y; - gui_cursor_display_debug_info (); - gui_window_move_cursor (); + x = x1; + y = y1; } + else if (strcmp (position, "top_right") == 0) + { + x = x2; + y = y1; + } + else if (strcmp (position, "bottom_left") == 0) + { + x = x1; + y = y2; + } + else if (strcmp (position, "bottom_right") == 0) + { + x = x2; + y = y2; + } + else + { + x = x1; + y = y1; + } + + if (!gui_cursor_mode) + gui_cursor_mode_toggle (); + gui_cursor_x = x; + gui_cursor_y = y; + gui_cursor_display_debug_info (); + gui_window_move_cursor (); } diff --git a/src/gui/gui-cursor.h b/src/gui/gui-cursor.h index 5c5753293..b14a58f87 100644 --- a/src/gui/gui-cursor.h +++ b/src/gui/gui-cursor.h @@ -34,7 +34,8 @@ extern void gui_cursor_mode_stop (); extern void gui_cursor_debug_set (int debug); extern void gui_cursor_move_xy (int x, int y); extern void gui_cursor_move_add_xy (int add_x, int add_y); +extern void gui_cursor_move_position (const char *position); extern void gui_cursor_move_area_add_xy (int add_x, int add_y); -extern void gui_cursor_move_area (const char *area); +extern void gui_cursor_move_area (const char *area, const char *position); #endif /* WEECHAT_GUI_CURSOR_H */