Provide shorter UI/Keyboard sequence to edit the last message #1147

Closed
bmalynovytch opened this Issue Jun 30, 2016 · 13 comments

Projects

None yet

4 participants

@bmalynovytch

Dear team,

Editing a previously sent message is painful compared to other instant messaging solutions.

While typing in a conversation and willing to edit your last message, you need to:

Zulip

  • press ESC to close the text box
  • press i to show the contextual menu with the edit option
  • press Enter to confirm that you wish to edit
  • edit your message
  • press Cmd + Enter to confirm edition (instead of usual Enter)

Skype / Slack

  • press up arrow
  • edit your message
  • press Enter
@timabbott timabbott changed the title from UI - Keyboard sequence to edit a message is painful to Provide shorter UI/Keyboard sequence to edit the last message Jun 30, 2016
@timabbott
Member

Yeah, it'd be good to make this easier, since editing the last message is the common case (even if we do still want to support the existing mechanism for editing older messages). I think there are 2 things we should do:

  • We should provide a faster keyboard sequence for editing the last message one sent to the current view; I'm not sure whether the best version is e.g. e to start edit (covering your first steps 2+3) or something one could do inside the open compose box (i.e. a control sequence or the insert key) to cover steps 1+2+3.
  • The enter_sends setting should also result in enter saving in the edit view (since the user will be used to whatever convention they're using for composing messages as to whether enter or shift-enter is how you produce a newline if you want one).

Does that sound reasonable to do you @bmalynovytch?

@bmalynovytch
  1. sounds good (e or something else, personally, I never use the arrow keys to navigate through the messages, therefore using the up key would be a could option)
  2. definitely, having the same behavior to confirm a message while sending a fresh new one or editing an old one seems the best to do

Thank you for your message 👍

@timabbott
Member

The arrow keys are the main way most folks navigate messages using the keyboard, so I don't think we can repurpose the up key.

@timabbott timabbott added the bite size label Jun 30, 2016
@timabbott timabbott added this to the Likely next milestone milestone Jul 7, 2016
@timabbott
Member

Left arrow key might be a good choice for this, what do you think @bmalynovytch?

@bmalynovytch

Hmm ... Why not, it's straightforward. Is it hard to implement ?

@timabbott
Member
timabbott commented Sep 13, 2016 edited

I haven't investigated specifically, but I suspect it would not be hard; likely a small amount of code in static/js/hotkeys.js that checks that the hotkey was pressed in the right context and then calls the appropriate function to start an edit on the latest message the user sent.

@deekshaarul
Contributor

@timabbott I would like to work on this issue. I have gone through all the linked .js files. I need a little more assistance regarding the same. Could you please guide me?

@timabbott
Member

Sure. I think what you need to do is:
(1) Add code in hotkey.js to handle the left-arrow hotkey; you can start with making it just do alert("Left"); to test your logic for triggering it in the right circumstances.
(2) Once you're happy with that logic, make it instead call message_edit.start() on the last message that the user sent in the currently visible view. The tricky part is computing the last message sent by the user in the current view; we'll probably need to add a new function in message_list.js that loops through the messages and checks whether the sender matches the current user.

@deekshaarul
Contributor
deekshaarul commented Oct 25, 2016 edited

@timabbott I could get left arrow to work. And to call message_edit.start() , I need the row id of the message that is in focus. I am having a tough time figuring how to get the row id of a focused message from an event triggered by keyboard. Most of the code has the lines when event is triggered by clicks. And for the tricky part, I will immediately read and understand message_list.js .

@timabbott
Member

Cool. Just to clarify: I think we want to trigger editing on the last message the user sent, not the currently selected message; getting the current selected message is easy (msg_list.selected_id() works), but unfortunately that does't do what we want.

@timabbott
Member

@deekshaarul are you still working on this?

@deekshaarul
Contributor

@timabbott I was working on this, though I won't be able to devote time for the next two weeks due to my semester exams.
If anyone wishes to take this, please feel free.

If no one takes this by first week of December, I am open to working on this. :)

@aakash-cr7
Contributor
aakash-cr7 commented Nov 22, 2016 edited

@deekshaarul I have started working on this and it's almost finished I'd post a PR within a day or two.

@timabbott I had one question. Do we have to enable the user to edit the very last message he sent OR the last message the user sent in each stream and topic?

@TigorC TigorC added a commit to TigorC/zulip that referenced this issue Nov 23, 2016
@TigorC TigorC Added keyboard shortcut to edit the last message
Fixes #1147
7553ad7
@TigorC TigorC added a commit to TigorC/zulip that referenced this issue Nov 23, 2016
@TigorC TigorC Added keyboard shortcut to edit the last message
Fixes #1147
6968d0f
@TigorC TigorC added a commit to TigorC/zulip that referenced this issue Nov 28, 2016
@TigorC TigorC Added keyboard shortcut to edit the last message
Fixes #1147
6e97faf
@TigorC TigorC added a commit to TigorC/zulip that referenced this issue Dec 6, 2016
@TigorC TigorC Added keyboard shortcut to edit the last message
Fixes #1147
d4daa73
@TigorC TigorC added a commit to TigorC/zulip that referenced this issue Dec 6, 2016
@TigorC TigorC Added keyboard shortcut to edit the last message
Fixes #1147
d500cb0
@TigorC TigorC added a commit to TigorC/zulip that referenced this issue Dec 12, 2016
@TigorC TigorC Added keyboard shortcut to edit the last message
Fixes #1147
fd09fa3
@TigorC TigorC added a commit to TigorC/zulip that referenced this issue Dec 13, 2016
@TigorC TigorC Added keyboard shortcut to edit the last message
Fixes #1147
494091e
@timabbott timabbott added a commit that closed this issue Feb 12, 2017
@TigorC @timabbott TigorC + timabbott Added keyboard shortcut to edit the last message.
Tweaked significantly by tabbott to update Casper tests, document the
new feature, and fix hotkeys.

Fixes #1147.
55cffa1
@timabbott timabbott closed this in 55cffa1 Feb 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment