C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
pick_engine.c File Reference

pick from a list of choices More...

#include <common.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <termios.h>
#include <unistd.h>
Include dependency graph for pick_engine.c:

Go to the source code of this file.

Functions

int pick_engine (Init *init)
 Initializes pick interface, calculates window size and position, and enters picker loop.
void save_object (Pick *pick, char *s)
 Saves a string as an object in the pick structure.
int picker (Init *init)
 Main loop to handle user input and interactions for pick interface.
void display_page (Pick *pick)
 Displays current page of objects in pick window.
void reverse_object (Pick *pick)
 Reverses the display of the currently selected object in pick window.
void unreverse_object (Pick *pick)
 Unreverses the display of the currently selected object in pick window.
void toggle_object (Pick *pick)
 Toggles the selection state of the currently selected object in pick window.
int output_objects (Pick *pick)
 Outputs selected objects to specified output file.
int exec_objects (Init *init)
 Executes specified command with selected objects as arguments.
int open_pick_win (Init *init)
 Initializes the pick window based on the parameters specified in the Pick structure.
void display_pick_help (Init *init)
 Displays the help screen for the pick interface using view.
int read_pick_input (Init *init)
 Reads pick input from file pointer and saves objects into pick structure.
void deselect_object (Pick *pick)
 Deselects the currently selected object in pick window.
int init_pick (Init *init, int argc, char **argv, int begy, int begx)
 Initializes pick structure and opens pick input file or pipe.

Variables

int tbl_col
int tbl_line
int tbl_page
int tbl_cols
int pg_lines
int tbl_pages
int obj_idx
int calculated_idx
int pipe_fd [2]
char const pagers_editors [12][10]

Detailed Description

pick from a list of choices

Author
Bill Waller Copyright (c) 2025 MIT License billx.nosp@m.wall.nosp@m.er@gm.nosp@m.ail..nosp@m.com
Date
2026-02-09

Definition in file pick_engine.c.

Variable Documentation

◆ calculated_idx

int calculated_idx

Definition at line 24 of file pick_engine.c.

◆ obj_idx

int obj_idx

Definition at line 24 of file pick_engine.c.

◆ pagers_editors

char const pagers_editors[12][10]
Initial value:
= {"view", "view", "less", "more",
"vi", "vim", "nano", "nvim",
"pico", "emacs", "edit", ""}

Definition at line 41 of file pick_engine.c.

41 {"view", "view", "less", "more",
42 "vi", "vim", "nano", "nvim",
43 "pico", "emacs", "edit", ""};

◆ pg_lines

int pg_lines

Definition at line 23 of file pick_engine.c.

◆ pipe_fd

int pipe_fd[2]

Definition at line 39 of file pick_engine.c.

Referenced by init_pick().

◆ tbl_col

int tbl_col

Definition at line 23 of file pick_engine.c.

◆ tbl_cols

int tbl_cols

Definition at line 23 of file pick_engine.c.

◆ tbl_line

int tbl_line

Definition at line 23 of file pick_engine.c.

◆ tbl_page

int tbl_page

Definition at line 23 of file pick_engine.c.

◆ tbl_pages

int tbl_pages

Definition at line 23 of file pick_engine.c.