Lines Matching +full:ps +full:- +full:hold

1 // SPDX-License-Identifier: GPL-2.0
35 /* Don't take this from <ctype.h>: 011-015 on the screen aren't spaces */
48 .start = -1,
54 /* set reverse video on characters s-e of console with selection. */
57 invert_screen(vc_sel.cons, s, e-s+2, true); in highlight()
76 * clear_selection - remove current selection
81 * Locking: The caller must hold the console lock.
85 highlight_pointer(-1); /* hide the pointer */ in clear_selection()
86 if (vc_sel.start != -1) { in clear_selection()
88 vc_sel.start = -1; in clear_selection()
104 0x03FFE000, /* digits and "-./" */
115 * sel_loadlut() - load the LUT table
128 return -EFAULT; in sel_loadlut()
143 /* stores the char in UTF8 and returns the number of bytes used (1-4) */
178 * set_selection_user - set the current selection.
193 return -EFAULT; in set_selection_user()
206 return -EPERM; in set_selection_user()
219 bp = kmalloc_array((vc_sel.end - vc_sel.start) / 2 + 1, unicode ? 4 : 1, in vc_selection_store_chars()
224 return -ENOMEM; in vc_selection_store_chars()
238 if (!((i + 2) % vc->vc_size_row)) { in vc_selection_store_chars()
240 unless non-space at end of line. */ in vc_selection_store_chars()
248 vc_sel.buf_len = bp - vc_sel.buffer; in vc_selection_store_chars()
253 static int vc_do_selection(struct vc_data *vc, unsigned short mode, int ps, in vc_do_selection() argument
260 case TIOCL_SELCHAR: /* character-by-character selection */ in vc_do_selection()
261 new_sel_start = ps; in vc_do_selection()
264 case TIOCL_SELWORD: /* word-by-word selection */ in vc_do_selection()
265 spc = is_space_on_vt(sel_pos(ps, unicode)); in vc_do_selection()
266 for (new_sel_start = ps; ; ps -= 2) { in vc_do_selection()
267 if ((spc && !is_space_on_vt(sel_pos(ps, unicode))) || in vc_do_selection()
268 (!spc && !inword(sel_pos(ps, unicode)))) in vc_do_selection()
270 new_sel_start = ps; in vc_do_selection()
271 if (!(ps % vc->vc_size_row)) in vc_do_selection()
281 if (!((pe + 2) % vc->vc_size_row)) in vc_do_selection()
285 case TIOCL_SELLINE: /* line-by-line selection */ in vc_do_selection()
286 new_sel_start = rounddown(ps, vc->vc_size_row); in vc_do_selection()
287 new_sel_end = rounddown(pe, vc->vc_size_row) + in vc_do_selection()
288 vc->vc_size_row - 2; in vc_do_selection()
294 return -EINVAL; in vc_do_selection()
298 highlight_pointer(-1); in vc_do_selection()
302 !atedge(new_sel_end, vc->vc_size_row) && in vc_do_selection()
306 atedge(pe, vc->vc_size_row)) in vc_do_selection()
311 if (vc_sel.start == -1) /* no current selection */ in vc_do_selection()
325 highlight(new_sel_start, vc_sel.start - 2); in vc_do_selection()
327 highlight(vc_sel.start, new_sel_start - 2); in vc_do_selection()
343 int ps, pe; in vc_selection() local
347 if (v->sel_mode == TIOCL_SELCLEAR) { in vc_selection()
353 v->xs = min_t(u16, v->xs - 1, vc->vc_cols - 1); in vc_selection()
354 v->ys = min_t(u16, v->ys - 1, vc->vc_rows - 1); in vc_selection()
355 v->xe = min_t(u16, v->xe - 1, vc->vc_cols - 1); in vc_selection()
356 v->ye = min_t(u16, v->ye - 1, vc->vc_rows - 1); in vc_selection()
358 if (mouse_reporting() && (v->sel_mode & TIOCL_SELMOUSEREPORT)) { in vc_selection()
359 mouse_report(tty, v->sel_mode & TIOCL_SELBUTTONMASK, v->xs, in vc_selection()
360 v->ys); in vc_selection()
364 ps = v->ys * vc->vc_size_row + (v->xs << 1); in vc_selection()
365 pe = v->ye * vc->vc_size_row + (v->xe << 1); in vc_selection()
366 if (ps > pe) /* make vc_sel.start <= vc_sel.end */ in vc_selection()
367 swap(ps, pe); in vc_selection()
374 return vc_do_selection(vc, v->sel_mode, ps, pe); in vc_selection()
400 struct vc_data *vc = tty->driver_data; in paste_selection()
413 return -EIO; /* ldisc was hung up */ in paste_selection()
414 tty_buffer_lock_exclusive(&vc->port); in paste_selection()
416 add_wait_queue(&vc->paste_wait, &wait); in paste_selection()
421 ret = -EINTR; in paste_selection()
431 count = vc_sel.buf_len - pasted; in paste_selection()
437 remove_wait_queue(&vc->paste_wait, &wait); in paste_selection()
440 tty_buffer_unlock_exclusive(&vc->port); in paste_selection()