[LyX/master] Remove one user of cursorX/Y
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Mon Jul 13 09:03:51 UTC 2026
commit 1ef698e7b64b585d660a2cb64e0e29c810128b41
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Mon Jul 13 10:47:15 2026 +0200
Remove one user of cursorX/Y
Additionally fix server-get-xy to return absolute coordinates. Note
that server-set-xy needs fixing too, but I am not sure that it is
used.
I do not know how to use the server, so testing is welcome.
---
src/BufferView.cpp | 7 +++++++
src/Text.cpp | 8 +-------
src/insets/InsetDynamicArgs.cpp | 1 -
src/mathed/InsetMathNest.cpp | 3 ---
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index c64eb8a8ae..2982cb1322 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1312,6 +1312,7 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
case LFUN_KEYMAP_SECONDARY:
case LFUN_KEYMAP_TOGGLE:
case LFUN_INSET_SELECT_ALL:
+ case LFUN_SERVER_GET_XY:
flag.setEnabled(true);
break;
@@ -2693,6 +2694,12 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
cur.message(_("Copy"));
break;
+ case LFUN_SERVER_GET_XY: {
+ Point const p = getPos(cursor());
+ cursor().message(from_utf8(convert<string>(p.x) + ' ' + convert<string>(p.y)));
+ break;
+ }
+
default:
// OK, so try the Buffer itself...
buffer_.dispatch(cmd, dr);
diff --git a/src/Text.cpp b/src/Text.cpp
index 86032321ed..4eefd53d98 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -5010,12 +5010,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
cur.message(_("Cut"));
break;
- case LFUN_SERVER_GET_XY:
- cur.message(from_utf8(
- convert<string>(tm->cursorX(cur.top(), cur.boundary()))
- + ' ' + convert<string>(tm->cursorY(cur.top(), cur.boundary()))));
- break;
-
+ // FIXME: move this to BufferView?
case LFUN_SERVER_SET_XY: {
int x = 0;
int y = 0;
@@ -7232,7 +7227,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_WORD_CAPITALIZE:
case LFUN_WORD_INVERTCASE:
case LFUN_CHARS_TRANSPOSE:
- case LFUN_SERVER_GET_XY:
case LFUN_SERVER_SET_XY:
case LFUN_SERVER_GET_LAYOUT:
case LFUN_SELF_INSERT:
diff --git a/src/insets/InsetDynamicArgs.cpp b/src/insets/InsetDynamicArgs.cpp
index b2550f6df8..a9d98ad9bf 100644
--- a/src/insets/InsetDynamicArgs.cpp
+++ b/src/insets/InsetDynamicArgs.cpp
@@ -123,7 +123,6 @@ bool InsetDynamicArgs::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_LINE_END:
case LFUN_CHAR_DELETE_FORWARD:
case LFUN_CHAR_DELETE_BACKWARD:
- case LFUN_SERVER_GET_XY:
case LFUN_SERVER_SET_XY:
case LFUN_SERVER_GET_LAYOUT:
case LFUN_ESCAPE:
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 1d8a5982d9..facda69d93 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -1205,9 +1205,6 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
}
break;
- //case LFUN_SERVER_GET_XY:
- // break;
-
case LFUN_SERVER_SET_XY: {
lyxerr << "LFUN_SERVER_SET_XY broken!" << endl;
int x = 0;
More information about the lyx-cvs
mailing list