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()
205 bp = kmalloc_array((vc_sel.end - vc_sel.start) / 2 + 1, unicode ? 4 : 1, in vc_selection_store_chars()
210 return -ENOMEM; in vc_selection_store_chars()
224 if (!((i + 2) % vc->vc_size_row)) { in vc_selection_store_chars()
226 unless non-space at end of line. */ in vc_selection_store_chars()
234 vc_sel.buf_len = bp - vc_sel.buffer; in vc_selection_store_chars()
239 static int vc_do_selection(struct vc_data *vc, unsigned short mode, int ps, in vc_do_selection() argument
246 case TIOCL_SELCHAR: /* character-by-character selection */ in vc_do_selection()
247 new_sel_start = ps; in vc_do_selection()
250 case TIOCL_SELWORD: /* word-by-word selection */ in vc_do_selection()
251 spc = is_space_on_vt(sel_pos(ps, unicode)); in vc_do_selection()
252 for (new_sel_start = ps; ; ps -= 2) { in vc_do_selection()
253 if ((spc && !is_space_on_vt(sel_pos(ps, unicode))) || in vc_do_selection()
254 (!spc && !inword(sel_pos(ps, unicode)))) in vc_do_selection()
256 new_sel_start = ps; in vc_do_selection()
257 if (!(ps % vc->vc_size_row)) in vc_do_selection()
267 if (!((pe + 2) % vc->vc_size_row)) in vc_do_selection()
271 case TIOCL_SELLINE: /* line-by-line selection */ in vc_do_selection()
272 new_sel_start = rounddown(ps, vc->vc_size_row); in vc_do_selection()
273 new_sel_end = rounddown(pe, vc->vc_size_row) + in vc_do_selection()
274 vc->vc_size_row - 2; in vc_do_selection()
280 return -EINVAL; in vc_do_selection()
284 highlight_pointer(-1); in vc_do_selection()
288 !atedge(new_sel_end, vc->vc_size_row) && in vc_do_selection()
292 atedge(pe, vc->vc_size_row)) in vc_do_selection()
297 if (vc_sel.start == -1) /* no current selection */ in vc_do_selection()
311 highlight(new_sel_start, vc_sel.start - 2); in vc_do_selection()
313 highlight(vc_sel.start, new_sel_start - 2); in vc_do_selection()
329 int ps, pe; in vc_selection() local
333 if (v->sel_mode == TIOCL_SELCLEAR) { in vc_selection()
339 v->xs = min_t(u16, v->xs - 1, vc->vc_cols - 1); in vc_selection()
340 v->ys = min_t(u16, v->ys - 1, vc->vc_rows - 1); in vc_selection()
341 v->xe = min_t(u16, v->xe - 1, vc->vc_cols - 1); in vc_selection()
342 v->ye = min_t(u16, v->ye - 1, vc->vc_rows - 1); in vc_selection()
344 if (mouse_reporting() && (v->sel_mode & TIOCL_SELMOUSEREPORT)) { in vc_selection()
345 mouse_report(tty, v->sel_mode & TIOCL_SELBUTTONMASK, v->xs, in vc_selection()
346 v->ys); in vc_selection()
350 ps = v->ys * vc->vc_size_row + (v->xs << 1); in vc_selection()
351 pe = v->ye * vc->vc_size_row + (v->xe << 1); in vc_selection()
352 if (ps > pe) /* make vc_sel.start <= vc_sel.end */ in vc_selection()
353 swap(ps, pe); in vc_selection()
360 return vc_do_selection(vc, v->sel_mode, ps, pe); in vc_selection()
386 struct vc_data *vc = tty->driver_data; in paste_selection()
399 return -EIO; /* ldisc was hung up */ in paste_selection()
400 tty_buffer_lock_exclusive(&vc->port); in paste_selection()
402 add_wait_queue(&vc->paste_wait, &wait); in paste_selection()
407 ret = -EINTR; in paste_selection()
417 count = vc_sel.buf_len - pasted; in paste_selection()
423 remove_wait_queue(&vc->paste_wait, &wait); in paste_selection()
426 tty_buffer_unlock_exclusive(&vc->port); in paste_selection()