StringInput better unicode handling
- Add unicode handling in flow components in AbstractTextComponent which allows StringInput to process unicode given from jline. - This add basic non-english character support for input. - Fixes #1115
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -94,6 +94,7 @@ public class StringInput extends AbstractTextComponent<String, StringInputContex
|
||||
}
|
||||
String input;
|
||||
switch (operation) {
|
||||
case OPERATION_UNICODE:
|
||||
case OPERATION_CHAR:
|
||||
String lastBinding = bindingReader.getLastBinding();
|
||||
input = context.getInput();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,6 +60,7 @@ public abstract class AbstractComponent<T extends ComponentContext<T>> implement
|
||||
public final static String OPERATION_EXIT = "EXIT";
|
||||
public final static String OPERATION_BACKSPACE = "BACKSPACE";
|
||||
public final static String OPERATION_CHAR = "CHAR";
|
||||
public final static String OPERATION_UNICODE = "UNICODE";
|
||||
public final static String OPERATION_SELECT = "SELECT";
|
||||
public final static String OPERATION_DOWN = "DOWN";
|
||||
public final static String OPERATION_UP = "UP";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,6 +62,7 @@ public abstract class AbstractTextComponent<T, C extends TextComponentContext<T,
|
||||
for (char i = 32; i < KeyMap.KEYMAP_LENGTH - 1; i++) {
|
||||
keyMap.bind(OPERATION_CHAR, Character.toString(i));
|
||||
}
|
||||
keyMap.setUnicode(OPERATION_UNICODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user