-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Use vim_dialog_yesno
for the "file changed since reading" message
#29310
base: master
Are you sure you want to change the base?
Conversation
This is my first PR in neovim core so I'm not sure if I should assign anyone or who I could reach out to for feedback, but feedback is very much appreciated! |
de33f3f
to
e989b35
Compare
e989b35
to
fe69171
Compare
@tjdevries you're the only core maintainer I know the name of so tagging you for feedback and/or to point me in the right direction. This is my first PR in neovim :) |
if (vim_dialog_yesno(VIM_WARNING, | ||
NULL, | ||
_( | ||
"WARNING: The file has been changed since reading it. Do you really want to write to it?"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, any special reason to change the message slightly (e.g. dropping the exclamation marks)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No special reason, but I always found the three exclamation marks a bit over the top in addition to the all caps WARNING. Don't feel too strongly about it though.
msgstr "¿Desea realmente escribir al archivo?" | ||
#: ../bufwrite.c:362 | ||
msgid "WARNING: The file has been changed since reading it. Do you really want to write to it?" | ||
msgstr "ADVERTENCIA: El archivo ha cambiado desde que se leyó. ¿Desea realmente escribir en él?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about other locale files other than Spanish?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having trouble testing this one, :lang es_ES
on my dirty build doesn't seem to do anything. Do I have to put the localization files somewhere for it to pick them up?
{9: reading it!!!} | | ||
{6:Do you really want to write to it (y/n)?}| | ||
^ | | ||
{6:WARNING: The file has been changed since}| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be just a personal taste, but I would actually prefer shouting, intimidating warning messages that are put in red (WarningMsg
) or more discernible than simple MoreMsg
highlights.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I guess we could still print the first line in WARNING colors like it did before, but the main idea behind this change is to allow ui_attach
to handle this prompt gracefully, and splitting the message into two makes it harder to do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could also look into the implementation of do_dialog
to see if we can use different highlights for the message
{6:Press ENTER or type command to continue}^ | | ||
]]) | ||
|
||
feed('<cr>') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: why removing those tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With vim_dialog_yesno
, after pressing 'n', the "Press ENTER" line doesn't appear
this part is common to vim. I suggest you submit it to vim first. |
I could give it a shot, but I suspect they won't see the value in this change since the main reason is to make it play nicely with |
In order to allow more flexibility in how UI plugins like Noice handle this specific prompt, switch from using
ask_yesno
tovim_dialog_yesno
, which sends amsg_send.confirm
event which can be handled byvim.ui_attach
. This also brings it in line with other user prompts such as the swapfile dialog.Before:
![image](https://private-user-images.githubusercontent.com/13615693/339214314-a397fc9c-6fe4-4543-994b-d95d8d384331.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1Mzk4MjgsIm5iZiI6MTcxOTUzOTUyOCwicGF0aCI6Ii8xMzYxNTY5My8zMzkyMTQzMTQtYTM5N2ZjOWMtNmZlNC00NTQzLTk5NGItZDk1ZDhkMzg0MzMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpB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kPTAmcmVwb19pZD0wIn0.vMx1oNV14uHQsKcfY1zf2E61bzWhSMYLnwANKeI61ws)
With Noice:
![image](https://private-user-images.githubusercontent.com/13615693/339214573-124e9195-b245-44b9-b63a-7bac34a61e89.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1Mzk4MjgsIm5iZiI6MTcxOTUzOTUyOCwicGF0aCI6Ii8xMzYxNTY5My8zMzkyMTQ1NzMtMTI0ZTkxOTUtYjI0NS00NGI5LWI2M2EtN2JhYzM0YTYxZTg5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI4VDAxNTIwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIxNDI4ODkzMmE5YThkYzdhMzZkODY0MmQ0MTM2MzM5MDNlODY5ZWFiMGMzMGNkYWFjNjM4NDI0N2ZkYWRiYTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.xkkZ4-aKeloMItMwtsNl89ucSUbWnELUeeNR7Sgp-x8)
Questions/feedback requested:
ask_yesno
used to add). I'm happy to take a crack at that, but I'm having trouble testing it. DoingVIMRUNTIME=runtime ./build/bin/nvim --clean
and then setting:lang es_ES
doesn't seem to use Spanish strings :/