MCPcopy Create free account
hub / github.com/NetHack/NetHack / mangle_tty_rows_columns

Function mangle_tty_rows_columns

outdated/sys/mac/mactty.c:1126–1171  ·  view source on GitHub ↗

* Delete or insert operations used by many terminals can bottleneck through * here. Note that the order of executin for row/colum insertions is NOT * specified. Negative values for num_ mean delete, zero means no effect. */

Source from the content-addressed store, hash-verified

1124 * specified. Negative values for num_ mean delete, zero means no effect.
1125 */
1126short
1127mangle_tty_rows_columns(WindowPtr window, short from_row, short num_rows,
1128 short from_column, short num_columns)
1129{
1130 Rect r;
1131 RgnHandle rh = NewRgn();
1132 RECORD_EXISTS(record);
1133
1134 update_tty(window); /* Always make sure screen is OK */
1135 curs_pos(record, record->x_curs, record->y_curs, 0);
1136
1137 if (num_rows) {
1138 pos_rect(record, &r, 0, from_row, record->x_size - 1,
1139 record->y_size - 1);
1140 select_offscreen_port(record);
1141 ScrollRect(&r, 0, num_rows * record->row_height, rh);
1142 EraseRgn(rh);
1143 SetEmptyRgn(rh);
1144 select_onscreen_window(record);
1145 ScrollRect(&r, 0, num_rows * record->row_height, rh);
1146 EraseRgn(rh);
1147 SetEmptyRgn(rh);
1148 }
1149 if (num_columns) {
1150 pos_rect(record, &r, from_column, 0, record->x_size - 1,
1151 record->y_size - 1);
1152 select_offscreen_port(record);
1153 ScrollRect(&r, num_columns * record->char_width, 0, rh);
1154 EraseRgn(rh);
1155 SetEmptyRgn(rh);
1156 select_onscreen_window(record);
1157 ScrollRect(&r, num_columns * record->char_width, 0, rh);
1158 EraseRgn(rh);
1159 SetEmptyRgn(rh);
1160 }
1161 DisposeRgn(rh);
1162 if (record->x_curs >= from_column) {
1163 record->x_curs += num_columns;
1164 }
1165 if (record->y_curs >= from_row) {
1166 record->y_curs += num_rows;
1167 }
1168 curs_pos(record, record->x_curs, record->y_curs, 1);
1169
1170 return noErr;
1171}
1172
1173/*
1174 * Frame an area in an aesthetically pleasing way.

Callers

nothing calls this directly

Calls 5

update_ttyFunction · 0.85
curs_posFunction · 0.85
pos_rectFunction · 0.85
select_offscreen_portFunction · 0.85
select_onscreen_windowFunction · 0.85

Tested by

no test coverage detected