Kotlin / kotlin-interactive-shell

Kotlin Language Interactive Shell
Apache License 2.0
587 stars 36 forks source link

Paste in ki-shell is weird #119

Closed LaurentBerger closed 8 months ago

LaurentBerger commented 1 year ago

Hi,

my code is

for (idx in 5..10) {
    if (idx>7) 
        break
    println("Compteur $idx")
}

If I type using keyboard using ki-shell 0.5.2/1.7.0 everything is fined (line 74) Now if i use paste and copy (line 79) then it is weird : there is a strange message in the middle and at the end result is OK

here screen copy of console

[74] for (idx in 5..10) {
...    if (idx>7)
...        break
...    println("Compteur $idx")
...    }
Compteur 5
Compteur 6
Compteur 7
[79] for (idx in 5..10) {
...    if (idx>7)
...
!in                                    Line_54                                buildList(
!is                                    Line_56_completion_7                   buildMap {
AS_SAFE                                Line_59                                buildMap(
AbstractCollection                     Line_60                                buildSet {
AbstractIterator                       Line_61                                buildSet(
AbstractList                           Line_62                                buildString {
AbstractMap                            Line_63                                buildString(
AbstractMethodError                    Line_64                                by
AbstractMutableCollection              Line_66_completion_8                   byteArrayOf(
AbstractMutableList                    Line_70                                catch
AbstractMutableMap                     Line_71                                charArrayOf(
AbstractMutableSet                     Line_72                                charset(
AbstractSet                            Line_73                                check(
AccessDeniedException                  Line_74                                checkNotNull(
Annotation                             Line_79                                class
AnnotationRetention                    Line_8                                 companion
AnnotationTarget                       Line_81_completion_9                   compareBy {
Any                                    LinkageError                           compareBy(
Appendable                             LinkedHashMap                          compareByDescending {
ArithmeticException                    LinkedHashSet                          compareByDescending(
Array                                  List                                   compareValues(
ArrayDeque                             List(                                  compareValuesBy(
ArrayIndexOutOfBoundsException         ListIterator                           const
ArrayList                              Long                                   constructor
ArrayStoreException                    LongArray                              context
AssertionError                         LongIterator                           continue
AutoCloseable                          LongProgression                        contract
AutoCloseable {                        LongRange                              createTempDir(
Boolean                                Map                                    createTempFile(
BooleanArray                           MatchGroup                             crossinline
BooleanIterator                        MatchGroupCollection                   data
BootstrapMethodError                   MatchNamedGroupCollection              delegate
BuilderInference                       MatchResult                            do
Byte                                   Math                                   doubleArrayOf(
ByteArray                              Metadata                               dynamic
ByteIterator                           Module                                 else
Char                                   ModuleLayer                            emptyArray()
Char(                                  MustBeDocumented                       emptyList()
CharArray                              MutableCollection                      emptyMap()
CharCategory                           MutableIterable                        emptySequence()
CharDirectionality                     MutableIterator                        emptySet()
CharIterator                           MutableList                            enum
CharProgression                        MutableList(                           enumValueOf(
CharRange                              MutableListIterator                    enumValues()
CharSequence                           MutableMap                             equals(
Character                              MutableSet                             error(
CharacterCodingException               NegativeArraySizeException             expect
Charsets                               NoClassDefFoundError                   external
Class                                  NoSuchElementException                 false
ClassCastException                     NoSuchFieldError                       field
ClassCircularityError                  NoSuchFieldException                   file
ClassFormatError                       NoSuchFileException                    final
ClassLoader                            NoSuchMethodError                      finally
ClassNotFoundException                 NoSuchMethodException                  floatArrayOf(
ClassValue                             NoWhenBranchMatchedException           for
CloneNotSupportedException             NotImplementedError                    fun
Cloneable                              Nothing                                generateSequence {
ClosedFloatingPointRange               NullPointerException                   generateSequence(
ClosedRange                            Number                                 get
Collection                             NumberFormatException                  hashCode()
Comparable                             Object                                 hashMapOf(
Comparator                             OnErrorAction                          hashMapOf()
Comparator {                           OptIn                                  hashSetOf(
Compiler                               OptionalExpectation                    hashSetOf()
ConcurrentModificationException        OutOfMemoryError                       header
ContextFunctionTypeParams              OverloadResolutionByLambdaReturnType   idx
DEFAULT_BUFFER_SIZE                    Override                               if
DeepRecursiveFunction                  Package                                impl
DeepRecursiveScope                     Pair                                   import
DependsOn                              ParameterName                          in
Deprecated                             Process                                infix
DeprecatedSinceKotlin                  ProcessBuilder                         init
DeprecationLevel                       ProcessHandle                          inline
Double                                 PublishedApi                           inner
DoubleArray                            PurelyImplements                       intArrayOf(
DoubleIterator                         RandomAccess                           interface
DslMarker                              Readable                               internal
Enum                                   Readable {                             is
EnumConstantNotPresentException        Record                                 iterator(
Error                                  ReflectiveOperationException           javaClass
Exception                              Regex                                  lateinit
ExceptionInInitializerError            RegexOption                            lazy {
Experimental                           Repeatable                             lazy(
ExperimentalMultiplatform              ReplaceWith                            lazyOf(
ExperimentalStdlibApi                  Repository                             let {
ExperimentalUnsignedTypes              RequiresOptIn                          linkedMapOf(
ExtensionFunctionType                  Result                                 linkedMapOf()
FileAlreadyExistsException             Retention                              linkedSetOf(
FileSystemException                    Runnable                               linkedSetOf()
FileTreeWalk                           Runnable {                             listOf(
FileWalkDirection                      Runtime                                listOf()
Float                                  RuntimeException                       listOfNotNull(
FloatArray                             RuntimePermission                      longArrayOf(
FloatIterator                          SafeVarargs                            mapOf(
Function                               SecurityException                      mapOf()
FunctionalInterface                    SecurityManager                        maxOf(
Grouping                               Sequence                               minOf(
HashMap                                Sequence {                             mutableListOf(
HashSet                                SequenceScope                          mutableListOf()
IllegalAccessError                     Set                                    mutableMapOf(
IllegalAccessException                 Short                                  mutableMapOf()
IllegalArgumentException               ShortArray                             mutableSetOf(
IllegalCallerException                 ShortIterator                          mutableSetOf()
IllegalMonitorStateException           SinceKotlin                            naturalOrder()
IllegalStateException                  StackOverflowError                     noinline
IllegalThreadStateException            StackTraceElement                      null
IncompatibleClassChangeError           StackWalker                            nullsFirst(
IndexOutOfBoundsException              StrictMath                             nullsFirst()
IndexedValue                           Strictfp                               nullsLast(
InheritableThreadLocal                 String                                 nullsLast()
InstantiationError                     String(                                object
InstantiationException                 StringBuffer                           open
Int                                    StringBuilder                          operator
IntArray                               StringIndexOutOfBoundsException        out
IntIterator                            Suppress                               override
IntProgression                         SuppressWarnings                       package
IntRange                               Synchronized                           param
Integer                                System                                 print(
InternalError                          TODO(                                  println(
InterruptedException                   TODO()                                 println()
Iterable                               Target                                 private
Iterable {                             Thread                                 property
Iterator                               ThreadDeath                            protected
JvmDefault                             ThreadGroup                            public
JvmDefaultWithCompatibility            ThreadLocal                            readLine()
JvmDefaultWithoutCompatibility         Throwable                              readln()
JvmField                               Throws                                 readlnOrNull()
JvmInline                              Transient                              receiver
JvmMultifileClass                      Triple                                 reified
JvmName                                TypeCastException                      repeat(
JvmOverloads                           TypeNotPresentException                require(
JvmRecord                              Typography                             requireNotNull(
JvmRepeatable                          UByte                                  return
JvmStatic                              UByteArray                             reverseOrder()
JvmSuppressWildcards                   UByteArray(                            run {
JvmSynthetic                           UInt                                   runCatching {
JvmWildcard                            UIntArray                              sealed
KotlinNullPointerException             UIntArray(                             sequence(
KotlinReflectionNotSupportedError      UIntProgression                        sequenceOf(
KotlinVersion                          UIntRange                              set
LayerInstantiationException            ULong                                  setOf(
Lazy                                   ULongArray                             setOf()
LazyThreadSafetyMode                   ULongArray(                            setOfNotNull(
Line_1                                 ULongProgression                       setparam
Line_10_completion_1                   ULongRange                             shortArrayOf(
Line_11                                UShort                                 sortedMapOf(
Line_12                                UShortArray                            sortedSetOf(
Line_14                                UShortArray(                           super
Line_15                                UninitializedPropertyAccessException   suspend
Line_16                                Unit                                   suspend(
Line_17                                UnknownError                           synchronized(
Line_18                                UnsafeVariance                         tailrec
Line_20_completion_2                   UnsatisfiedLinkError                   takeIf {
Line_21                                UnsupportedClassVersionError           takeUnless {
Line_22                                UnsupportedOperationException          this
Line_24_completion_3                   UseExperimental                        throw
Line_25                                VerifyError                            to(
Line_26                                VirtualMachineError                    toString()
Line_28                                Void                                   true
Line_31                                Volatile                               try
Line_33_completion_4                   `module-info`                          typealias
Line_35                                abstract                               typeof
Line_36                                actual                                 ubyteArrayOf(
Line_38                                also {                                 uintArrayOf(
Line_39                                annotation                             ulongArrayOf(
Line_4                                 apply {                                ushortArrayOf(
Line_40                                arrayListOf(                           val
Line_41                                arrayListOf()                          value
Line_42                                arrayOf(                               var
Line_44_completion_5                   arrayOfNulls(                          vararg
Line_46                                as                                     when
Line_47                                assert(                                where
Line_49                                booleanArrayOf(                        while
Line_5                                 break                                  with(
Line_51_completion_6                   buildList {                            x
...break
...    println("Compteur $idx")
...}
Compteur 5
Compteur 6
Compteur 7
LaurentBerger commented 1 year ago

Is ki-shell dead?

klitoskyriacou commented 8 months ago

I suspect that the TAB characters in your code before "break" are causing ki to think you've pressed the TAB key which indicates a request for autocompletion. I tried reproducing this on my Linux PC but it works ok here. I suspect you're using Windows.

Ki-shell seems to be alive, though not very active. There were some new commits on the main branch recently.