forked from aniani/vim
patch 8.2.3043: Amiga: cannot get the shell size on MorphOS and AROS
Problem: Amiga: cannot get the shell size on MorphOS and AROS. Solution: Use control sequences. (Ola Söder, closes #8438)
This commit is contained in:
committed by
Bram Moolenaar
parent
6738fd2000
commit
d415d26913
@@ -1008,7 +1008,58 @@ mch_settmode(tmode_T tmode)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* try to get the real window size
|
* Get console size in a system friendly way on AROS and MorphOS.
|
||||||
|
* Return FAIL for failure, OK otherwise
|
||||||
|
*/
|
||||||
|
#if defined(__AROS__) || defined(__MORPHOS__)
|
||||||
|
int
|
||||||
|
mch_get_shellsize(void)
|
||||||
|
{
|
||||||
|
if (!term_console)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
if (raw_in && raw_out)
|
||||||
|
{
|
||||||
|
// Save current console mode.
|
||||||
|
int old_tmode = cur_tmode;
|
||||||
|
char ctrl[] = "\x9b""0 q";
|
||||||
|
|
||||||
|
// Set RAW mode.
|
||||||
|
mch_settmode(TMODE_RAW);
|
||||||
|
|
||||||
|
// Write control sequence to console.
|
||||||
|
if (Write(raw_out, ctrl, sizeof(ctrl)) == sizeof(ctrl))
|
||||||
|
{
|
||||||
|
char scan[] = "\x9b""1;1;%d;%d r",
|
||||||
|
answ[sizeof(scan) + 8] = { '\0' };
|
||||||
|
|
||||||
|
// Read return sequence from input.
|
||||||
|
if (Read(raw_in, answ, sizeof(answ) - 1) > 0)
|
||||||
|
{
|
||||||
|
// Parse result and set Vim globals.
|
||||||
|
if (sscanf(answ, scan, &Rows, &Columns) == 2)
|
||||||
|
{
|
||||||
|
// Restore console mode.
|
||||||
|
mch_settmode(old_tmode);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore console mode.
|
||||||
|
mch_settmode(old_tmode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// I/O error. Default size fallback.
|
||||||
|
term_console = FALSE;
|
||||||
|
Columns = 80;
|
||||||
|
Rows = 24;
|
||||||
|
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* Try to get the real window size,
|
||||||
* return FAIL for failure, OK otherwise
|
* return FAIL for failure, OK otherwise
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
@@ -1040,13 +1091,8 @@ mch_get_shellsize(void)
|
|||||||
OUT_STR("\233t\233u"); // CSI t CSI u
|
OUT_STR("\233t\233u"); // CSI t CSI u
|
||||||
out_flush();
|
out_flush();
|
||||||
|
|
||||||
#ifdef __AROS__
|
|
||||||
if (!Info(raw_out, id)
|
|
||||||
|| (wb_window = (struct Window *) id->id_VolumeNode) == NULL)
|
|
||||||
#else
|
|
||||||
if (dos_packet(MP(raw_out), (long)ACTION_DISK_INFO, ((ULONG) id) >> 2) == 0
|
if (dos_packet(MP(raw_out), (long)ACTION_DISK_INFO, ((ULONG) id) >> 2) == 0
|
||||||
|| (wb_window = (struct Window *)id->id_VolumeNode) == NULL)
|
|| (wb_window = (struct Window *)id->id_VolumeNode) == NULL)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// it's not an amiga window, maybe aux device
|
// it's not an amiga window, maybe aux device
|
||||||
// terminal type should be set
|
// terminal type should be set
|
||||||
@@ -1081,6 +1127,7 @@ out:
|
|||||||
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to set the real window size to Rows and Columns.
|
* Try to set the real window size to Rows and Columns.
|
||||||
|
@@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3043,
|
||||||
/**/
|
/**/
|
||||||
3042,
|
3042,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user