Ish: Selecting text will copy it into the pasteboard

Created on 9 Dec 2018  ·  31Comments  ·  Source: ish-app/ish

In the latest TestFlight build 35, when I just long press text to select it on iSH, it will be copied into the pasteboard even if I don’t tap the “Copy” item.

How to reproduce it: https://youtu.be/OoDOArAkhSg

  1. Select text
  2. Tap “Paste” item

I reproduced the issue on

  • 3rd generation 12.9” iPad Pro with iOS 12.1.1
  • iPad Air 2 with iOS 12.1
  • iPhone XS with iOS 12.1.1

Related to #25

Most helpful comment

I have traced (void)copy:(id)sender and this one, when long press and selecting, is called a lot (6 to 8 time) without tapping copy, and is called one more time when tapping copy.

the first lot of calls was performed with a null sender (don't ask me why, I'm not an iOs UI guru) and the one when tapping copy is called with an UIMenuController sender.

so, I have simply modify (void)copy:(id)sender with the following:

- (void)copy:(id)sender {
    if(sender != NULL) {
        // not longer necessary :-) NSLog(@"copy called %@", sender);

         [self.terminal.webView evaluateJavaScript:@"window.getSelection().toString()" completionHandler:^(NSString *selection, NSError *err) {
            if (err != nil) {
                NSLog(@"error copying: %@", err);
                return;
            }
            UIPasteboard.generalPasteboard.string = selection;
        }];
    }
}

and, tada :-), long press and selecting no longer copy directly, but now you should press copy to copy to the clipboard ;-)

a side effect is a long tap select and show the paste button, this one paste the previous copied text (like the paste button above the keyboard .... )

All 31 comments

Yep, can confirm. I've reproduced it on an iPhone X running iOS 12.1.1 and an iPhone 6 running 11.3.1.

I can consistently not reproduce this with video proof 😅

I can’t reproduce either, on 11.4. This is definitely not supposed to happen though.

@ELChris414 @tbodt That’s weird. 🤔

The issue doesn’t happen on other apps such as Notes, Safari, and Blink Shell.

I confirm the issue (ios 12.1.1)
and so, I can't past text from other sources.

edit: maybe it's an another way to past without a long press ?

@francoisvignon If you use an external keyboard, you can paste by pressing CMD+V. I don’t know any other way.

many thanks for your answer …. no external keyboard available :-/

why not using Ctrl+V as Ctrl is already present ?


Francois

Le 10 déc. 2018 à 16:12, Kenta Kubo notifications@github.com a écrit :

@francoisvignon https://github.com/francoisvignon If you use an external keyboard, you can paste by pressing CMD+V. I don’t know any other way.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/tbodt/ish/issues/174#issuecomment-445849882, or mute the thread https://github.com/notifications/unsubscribe-auth/ArnvUvXwmD-DOJj44ilgN7zZLMsAJBqyks5u3nnggaJpZM4ZKLGJ.

You could try using SwiftKey for now. It has a clipboard manager and can paste without app support.

https://imgur.com/a/sanRLud

@francoisvignon ctrl-v enters visual block mode in vim.

ok :-/ ... will wait for long past not longer direct copy to clipboard ;-)

send from my mobile.


François

Le 10 déc. 2018 à 18:19, Theodore Dubois notifications@github.com a écrit :

@francoisvignon ctrl-v enters visual block mode in vim.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

I've updated to 12.1.1 and still can't reproduce on iPod Touch.

I'm having this issue too on iPhone X with iOS 12.1, perhaps as a workaround (especially since you seem unable to reproduce it @tbodt, and is presumably therefore pretty hard to debug), you could add a dedicated paste key in the row of modifier keys? For me that would also be more intuitive to use, and presumably avoid this bug (based on those saying that external keyboards with Cmd + v work fine)

https://share.icloud.com/photos/02EaRk5ZN7qKJsQXqfifBCdBQ

a small how to reproduce
long click on ´tutu' :
the text is select and copy/paster is show, then click on copy

long click at cursor level:
a part of the line is selected and cooy/paste is show, then click on paste

the pasted text is the last selected, not the last copied.

I hope it's helpfull

send from my mobile.


François

Le 15 déc. 2018 à 17:12, Theodore Dubois notifications@github.com a écrit :

I've updated to 12.1.1 and still can't reproduce on iPod Touch.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

This is definitely a widespread issue - https://twitter.com/leiser_patrick/status/1073972757459660801

maybe to help: once text is selected and without pressing copy, the selected text is in the clipboard: selecting text in iSh (with button copy|paste still displayed) and pasting on the Mac past the selected text.

shortly, it’s seem like (void)copy:(id)sender was called when dragging the selection …. and after some try, the 'copy' was called when stoping selection, when copy|paste button appear.

I don’t know enough Xcode and iOs development to be more helpful at this time :-/

PS: I know copy/paste is not an important feature, but it’s helpful to copy/past shell command and other source as long Files App cannot write iSh files ;-)


Francois

Le 17 déc. 2018 à 17:25, Martin Persson notifications@github.com a écrit :

This is definitely a widespread issue - https://twitter.com/leiser_patrick/status/1073972757459660801 https://twitter.com/leiser_patrick/status/1073972757459660801

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/tbodt/ish/issues/174#issuecomment-447905875, or mute the thread https://github.com/notifications/unsubscribe-auth/ArnvUpK40XSM1oXZFJxveJ0BabG_8I0Wks5u58VrgaJpZM4ZKLGJ.

Why would it invoke copy: before the copy button was pressed...

I don't know .... if it was under windows (arggghh sorry), it can be mistake between mouse up and copy to clipboard (maybe not the most accurate sample, but that's all I have at this time).

maybe a wrong link (or other) in the storyboard invoking copy when release the hang ... no more idea.

but the computer is the truth: if something is done, it's because somebody do it.

So, as other app don't have the same behavior, I think we can exclude iOs and the hardware.

the source (!) of the problem is, I think (sorry for that, but I know), between the chair and the keyboard.

Sometime, solving small bug need a lot of effort :-(

send from my mobile.


François

Le 17 déc. 2018 à 22:29, Theodore Dubois notifications@github.com a écrit :

Why would it invoke copy: before the copy button was pressed...


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Yeah, I've had the same observation, selecting text copies it, regardless of using or not the copy/paste dialog

maybe the problem is in the js related to term ?

send from my mobile.


François

Le 17 déc. 2018 à 22:29, Theodore Dubois notifications@github.com a écrit :

Why would it invoke copy: before the copy button was pressed...


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

I have traced (void)copy:(id)sender and this one, when long press and selecting, is called a lot (6 to 8 time) without tapping copy, and is called one more time when tapping copy.

the first lot of calls was performed with a null sender (don't ask me why, I'm not an iOs UI guru) and the one when tapping copy is called with an UIMenuController sender.

so, I have simply modify (void)copy:(id)sender with the following:

- (void)copy:(id)sender {
    if(sender != NULL) {
        // not longer necessary :-) NSLog(@"copy called %@", sender);

         [self.terminal.webView evaluateJavaScript:@"window.getSelection().toString()" completionHandler:^(NSString *selection, NSError *err) {
            if (err != nil) {
                NSLog(@"error copying: %@", err);
                return;
            }
            UIPasteboard.generalPasteboard.string = selection;
        }];
    }
}

and, tada :-), long press and selecting no longer copy directly, but now you should press copy to copy to the clipboard ;-)

a side effect is a long tap select and show the paste button, this one paste the previous copied text (like the paste button above the keyboard .... )

@francoisvignon thanks for debugging! I’m curious what the stack trace is when copy: is called with a nil sender. You can find it in the debug panel on the left sidebar, or by typing backtrace into LLDB. If you use the debug panel, you’ll want to click the tiny button at the bottom that enables showing stack frames that are part of system libraries, otherwise you probably won’t see anything useful.

the thread stack I seen is not helpfull: I seen copy is called this way
UIApplicationMain
NSObject_QSSupport _accessibilityQuickSpeakContent
UIDocumentSharingController
break point in copy

I will try according your indication tomorrow ...

but the true problem is why copy is called with a null sender ... I think some guru know why

NSObject_QSSupport _accessibilityQuickSpeakContent

wat

that could be very helpful actually

"wat" ?

I can reproduce this if Settings > Accessibility > Speech > Speak Text is on.

yesss !!!! so, now, as you can reproduce it, you can solve it.

send from my mobile.


François

Le 29 déc. 2018 à 18:43, Theodore Dubois notifications@github.com a écrit :

I can reproduce this if Settings > Accessibility > Speech > Speak Text is on.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

now we can use copy/past, we have another issue:
I have typed uname -a, ok
after I have selected "uname -a" and pasted, and then an error: uname -a not found.
so I have dump what I have copied:
echo " (then past) " .... and you can see the result bellow.
I think it's a problem in text encoding.

iFv:~# uname -a                                  
Linux iFv 3.2.0-ish SUPER AWESOME compiled on Dec
 29 2018 i686 Linux                              
iFv:~# uname -a                                  
-ash: uname -a: not found                        
iFv:~# echo "uname -a" | od -xc                  (the 'uname -a' was pasted)
0000000   u   n   a   m   e 302 240   -   a  \n  
        6e75 6d61 c265 2da0 0a61                 
0000012                                          
iFv:~#          

the problem is the space is copied as an unicode non breakable space (\302 \240) and not as a space (32)

thx


Francois

Le 29 déc. 2018 à 22:26, Theodore Dubois notifications@github.com a écrit :

Closed #174 https://github.com/tbodt/ish/issues/174 via 2090467 https://github.com/tbodt/ish/commit/2090467dd55ed4e334215670b9e76d230e9488d3.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/tbodt/ish/issues/174#event-2048221233, or mute the thread https://github.com/notifications/unsubscribe-auth/ArnvUsDQ15tOSM6lL4Gt2G7qgWoR5o0sks5u994FgaJpZM4ZKLGJ.

and you are one step forward on the path to be an UI Kit Guru ;-)

send from my mobile.


François

Le 29 déc. 2018 à 22:26, Theodore Dubois notifications@github.com a écrit :

Closed #174 via 2090467.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BrammyH picture BrammyH  ·  3Comments

ghanan94 picture ghanan94  ·  6Comments

fernandotcl picture fernandotcl  ·  4Comments

saman1111111 picture saman1111111  ·  4Comments

MasonProtter picture MasonProtter  ·  3Comments