Page MenuHomePhabricator

Slow Paste functionality
Open, WishlistPublic

Description

Hi,

I am working to add a slow paste functionality Terminology, which can be quite useful when working with serial connections pasting passwords and stuff.

I have made a POC implementation by just extracting common code from src/bin/termio.c function _getsel_cb, making fork of it _getsel_slow_cb, with main difference writing the buffer one-by-one with a sleep between them like this:

for (i = 0; i < pos; i++){
        
        termpty_write(sd->pty, buf+i, 1);
        usleep(100000);
        
}

This seems working with my current experience even with slow terminals. And for sure that hardcoded variable I will make eventually a configurable option.

My concern is that using a sleep there looks both kinda ugly and also is a bad UX since there is no feedback for ths user what is going on during the writing of the chars.

I browsed a bit in the timers and threads functions that were available in the efl libraries but wanted to get some feedback from experienced developers what would be the recommended approach to implement the slow paste in a way that:

  • After each sleep interval the user will be able to see the feedback from the remote system, say a pasting string "pass" to a system that "immediately" responses with the sent symbol user will see:
p <SLEEP X TIME> a <SLEEP X TIME> s <SLEEP X TIME> s <SLEEP X TIME>
  • Obviously during the pasting of the string is best to pause other input to the termio's pty, while pasting. Maybe set the termio in some state that will accumulate in a queue symbols that need to get to the pty and flush that buffer only after last of the chars from the pasted string is sent?

Any feedback is welcome :) Thanks in advance!

teacup_on_rc triaged this task as Wishlist priority.
billiob added a comment.EditedApr 26 2020, 3:53 AM

Are you using terminology from git? Because there was a bug and pasting stuff might not have worked as expected. It was fixed in
https://phab.enlightenment.org/rTRMb76bbbe45507e2c1c62e38b60f12c09eef176e15 ?

teacup_on_rc added a comment.EditedApr 26 2020, 6:19 AM

For now I patched the last release version so it is not the clone from git, but thanks for the tip. 🙇