['solved'] Pasting from clipboard problems

Linux specific questions.
Post Reply
Laurens
Posts: 17
Joined: Mar 16, 2022 9:16
Location: Flevoland, the Netherlands

['solved'] Pasting from clipboard problems

Post by Laurens »

Hello,

At this moment I'm suffering some trouble pasting text into the terminal window where my CLI app is running. I have created a new, simple file to test where the problem is, as follows:

Code: Select all

Dim As String Texts
Line Input Texts
Print Texts
Even with this simple code a few characters get taken over, and then everything hangs.

I'm using Debian 12 with Fbc 1.10 and Geany as IDE.

Thanks in advance for your help.

*edit: see workaround below.
Last edited by Laurens on Jul 04, 2023 20:23, edited 1 time in total.
Laurens
Posts: 17
Joined: Mar 16, 2022 9:16
Location: Flevoland, the Netherlands

Re: Pasting from clipboard problems

Post by Laurens »

In mean time I found a work-around for the time being. For those who encounter the same problems, here's the solution:

First, we have to create a subroutine wich will do the job:

Code: Select all

'GetLine: A Line Input replacement - some terminals hang when using Line Input

Sub GetLine (ByRef EnteredLine As String, ByRef Add As Boolean)

	If Add = False Then EnteredLine = ""
	Dim Keys As String
	
	Do Until Keys = Chr(13)
	Keys = Inkey
	
	If Keys <> Chr(13) And Len(Keys) = 1 Then 
		Print Keys;
		EnteredLine = EnteredLine + Keys
	End If
	
	Loop
	
	Keys = ""
	Print
	
End Sub
Now we can use it in stead of Line Input:

Code: Select all

GetLine (Texts,0) 'This works as a simple version of Line Input
GetLine (Texts,1) 'This adds the entered text to the previous existing text.
Post Reply