From b24e1e10a0262edd4d30b4a71bcb54e0fe270c00 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 9 Oct 2023 22:24:22 -0400 Subject: [PATCH] reposition the cursor for the context menu, but only if there is no selection --- tools/lammps-gui/CMakeLists.txt | 2 +- tools/lammps-gui/codeeditor.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/lammps-gui/CMakeLists.txt b/tools/lammps-gui/CMakeLists.txt index be7bcff10a..44fc45c0e2 100644 --- a/tools/lammps-gui/CMakeLists.txt +++ b/tools/lammps-gui/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16) -project(lammps-gui VERSION 1.5.8 LANGUAGES CXX) +project(lammps-gui VERSION 1.5.9 LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) diff --git a/tools/lammps-gui/codeeditor.cpp b/tools/lammps-gui/codeeditor.cpp index 46b970bd0a..af6e3b3790 100644 --- a/tools/lammps-gui/codeeditor.cpp +++ b/tools/lammps-gui/codeeditor.cpp @@ -668,7 +668,9 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) void CodeEditor::contextMenuEvent(QContextMenuEvent *event) { - // reposition the cursor here? + // reposition the cursor here, but only if there is no active selection + if (!textCursor().hasSelection()) setTextCursor(cursorForPosition(event->pos())); + QString page, help; find_help(page, help);