mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 03:41:10 +08:00
Fix DBCS first byte handling such as when pasted from clipboard
This commit is contained in:
parent
c6ef650655
commit
d83b26263d
@ -1050,6 +1050,8 @@ std::string log_dev_con_str;
|
||||
bool logging_con = false;
|
||||
bool DOS_BreakTest(bool print);
|
||||
void DOS_BreakAction();
|
||||
bool read_kanji1 = false;
|
||||
uint8_t temp_char = 0;
|
||||
|
||||
bool device_CON::Write(const uint8_t * data,uint16_t * size) {
|
||||
uint16_t count=0;
|
||||
@ -1114,15 +1116,31 @@ bool device_CON::Write(const uint8_t * data,uint16_t * size) {
|
||||
col = CURSOR_POS_COL(page);
|
||||
BIOS_NCOLS;
|
||||
|
||||
if(isDBCSCP() && !dos.direct_output && (col == ncols - 1)
|
||||
&& *size >= count+1 && isKanji1(data[count]) && isKanji2(data[count+1])) { // Consideration of first byte of DBCS characters at the end of line
|
||||
BIOS_NROWS;
|
||||
row = CURSOR_POS_ROW(page);
|
||||
if(nrows == row + 1) {
|
||||
INT10_ScrollWindow(0, 0, (uint8_t)(nrows - 1), (uint8_t)(ncols - 1), -1, ansi.attr, page);
|
||||
INT10_SetCursorPos(row, 0, page);
|
||||
if(isDBCSCP() && !dos.direct_output) { // Consideration of first byte of DBCS characters at the end of line
|
||||
if(!read_kanji1 && isKanji1(data[count])) {
|
||||
read_kanji1 = true;
|
||||
temp_char = data[count];
|
||||
count++;
|
||||
continue;
|
||||
}
|
||||
else if(read_kanji1) {
|
||||
if(col == ncols - 1 && isKanji2(data[count])) {
|
||||
BIOS_NROWS;
|
||||
row = CURSOR_POS_ROW(page);
|
||||
if(nrows == row + 1) {
|
||||
INT10_ScrollWindow(0, 0, (uint8_t)(nrows - 1), (uint8_t)(ncols - 1), -1, ansi.attr, page);
|
||||
INT10_SetCursorPos(row, 0, page);
|
||||
}
|
||||
else INT10_SetCursorPos(row + 1, 0, page);
|
||||
Output(temp_char);
|
||||
Output(data[count]);
|
||||
count++;
|
||||
read_kanji1 = false;
|
||||
continue;
|
||||
}
|
||||
else INT10_SetCursorPos(row + 1, 0, page);
|
||||
Output(temp_char);
|
||||
read_kanji1 = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ansi.esc){
|
||||
|
Loading…
x
Reference in New Issue
Block a user