v1cont / yad

Yet Another Dialog
GNU General Public License v3.0
660 stars 58 forks source link

ADD Option to Place Caret at the end of inputs prefilled text (and not selecting all text) #276

Open allanlaal opened 3 weeks ago

allanlaal commented 3 weeks ago

Title: Feature Request: Option to Place Caret at the End of Prefilled Input Text in yad Entry Dialogs


Description:

When using the --entry (and other?) options in yad to display a dialog with prefilled text, the caret is placed at the beginning of the text by default, and the entire text is preselected. This behavior is not always desirable, especially when the user intends to append text rather than replace it.

Requested Feature:

Please add an option or modify the behavior so that the caret can be placed at the end of the prefilled input text without preselecting all of it. This would improve usability in cases where the user needs to continue typing at the end of the existing text.

Example Usage:

we add --caret-end to yad:


yad --caret-end --entry --text "Enter your text:" --entry-text="Prefilled text" --editable 
step- commented 3 weeks ago

This feature can be achieved with vanilla GTK+-3 user settings. On my system:

$> cat ~/.config/gtk-3.0/settings.ini

[Settings]
# Prevent text entry widget select-on-focus, which overwrites X selection clipboard.
gtk-entry-select-on-focus = 0

But I don't know your Desktop Environment, GTK version and custom settings. Still worth trying, I think.

allanlaal commented 3 weeks ago

I installed my yad from apt, so its using GTK3:

Package: yad                             
Version: 0.40.0-1build3
New: yes
State: installed
Automatically installed: no
Priority: optional
Section: universe/utils
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Uncompressed Size: 567 k
Depends: libc6 (>= 2.34), libcairo2 (>= 1.2.4), libgdk-pixbuf-2.0-0 (>= 2.22.0),
         libglib2.0-0t64 (>= 2.30.0), libgtk-3-0t64 (>= 3.21.6), libpango-1.0-0
         (>= 1.14.0), libpangocairo-1.0-0 (>= 1.14.0)
Description: tool for creating graphical dialogs from shell scripts
 Yad allows you to display GTK+ dialog boxes from command line or shell scripts.
 It is similar to Zenity but with more dialog types and options.
Homepage: http://sourceforge.net/projects/yad-dialog/
allanlaal commented 3 weeks ago

gtk-entry-select-on-focus=0 resulted in the text not being selected, which is progress

however the caret is then put at start

allanlaal commented 3 weeks ago

\ even GTK4 does not have this, so made a feature request: #6959 ADD Setting to focus caret on the end of filled text input entry #UX

(however I did not test this in GTK4 :D ..yet) \

while it would be great if such settings.ini option would be added, we can fix this in yad too with: gtk_editable_set_position(editable, -1)