/* input_backspace: does a backspace in the input buffer */ void input_backspace(char key, char *blah) { cursor_to_input(); if (THIS_POS > MIN_POS) { char *ptr = NULL; int pos; malloc_strcpy(&ptr, &(THIS_CHAR)); strcpy(&(PREV_CHAR), ptr); new_free(&ptr); THIS_POS--; term_cursor_left(); if (THIS_CHAR) { if (term_delete()) update_input(UPDATE_FROM_CURSOR); { pos = str_start + term_cols - 1; pos += count_ansi(&(current_screen->input_buffer[str_start]), zone); if (pos < strlen(INPUT_BUFFER)) { term_move_cursor(term_cols - 1, input_line); term_putchar(INPUT_BUFFER[pos]); } update_input(UPDATE_JUST_CURSOR); } } else { term_putchar(' '); term_cursor_left(); update_input(NO_UPDATE); } } in_completion = STATE_NORMAL; *new_nick = 0; }
/* input_delete_character: deletes a character from the input line */ void input_delete_character(char unused, char *not_used) { cursor_to_input(); if (THIS_CHAR) { char *ptr = NULL; int pos; malloc_strcpy(&ptr, &(NEXT_CHAR)); strcpy(&(THIS_CHAR), ptr); new_free(&ptr); if (term_delete()) update_input(UPDATE_FROM_CURSOR); else { pos = str_start + term_cols - 1; pos += count_ansi(&(current_screen->input_buffer[str_start]), zone); if (pos < strlen(INPUT_BUFFER)) { term_move_cursor(term_cols - 1, input_line); term_putchar(INPUT_BUFFER[pos]); term_move_cursor(cursor, input_line); } update_input(NO_UPDATE); } } in_completion = STATE_NORMAL; }
extern status add_poly( polynomial *p_poly1, polynomial *p_poly2 ) { /* Polynomial p_poly1 += p_poly2, p_poly2 = 0 */ list lastreturn = NULL, match_node ; term *p_term, *p_match_term ; int coef, degree ; while( ( lastreturn = list_iterator( *p_poly1, lastreturn ) ) != NULL ) { p_term = ( term * ) DATA( lastreturn ) ; if( find_key( *p_poly2, (generic_ptr )p_term, cmp_degree, &match_node ) == OK ) { p_match_term = ( term * ) DATA( match_node ) ; p_term -> coefficient += p_match_term -> coefficient ; delete_node( p_poly2, match_node ) ; free( p_match_term ) ; } } while( empty_list( *p_poly2 ) == FALSE ) { if( term_delete( p_poly2, &coef, °ree ) == ERROR ) return ERROR ; else if( term_insert( p_poly1, coef, degree ) == ERROR ) return ERROR ; } return OK ; }
static void input_delete_char_from_screen (void) { /* * Remove the current character from the screen's display. * * If we cannot do a character delete then we do a wholesale * redraw of the input line (ugh). */ if (!(termfeatures & TERM_CAN_DELETE)) update_input(UPDATE_FROM_CURSOR); else { int pos; /* * Delete the character. This is the simple part. */ term_delete(1); /* * So right now we have a blank space at the right of the * screen. If there is a character in the input buffer that * is out in that position, we need to find it and display it. */ if (INPUT_ONSCREEN == 0) /* UGH! */ pos = last_input_screen->co - INPUT_PROMPT_LEN - 1; else pos = INPUT_ONSCREEN + last_input_screen->co - 1; if (pos < (int)strlen(INPUT_BUFFER)) { term_move_cursor(last_input_screen->co - 1, INPUT_LINE); term_putchar(INPUT_BUFFER[pos]); term_move_cursor(INPUT_CURSOR, INPUT_LINE); cursor_not_in_display(last_input_screen); } /* XXX - Very possibly, this is pointless */ update_input(NO_UPDATE); } }
void ed_close_cb(Plugin *plugin, Ed *ed, bool closed) { log_msg("ED", "ed_close_cb"); if (closed) { ed->state |= ED_CLOSED; ed_cleanup(ed); return; } term_delete(ed->base); window_refresh(); if (!ed_read_temp(ed)) return ed_cleanup(ed); if (ed->state == ED_RENAME) return ed_stage_confirm(ed); if (ed->state == ED_CONFRM) return ed_do_rename(ed); }
static int index_delete_term(fulltext_vtab *v, const char *zTerm, int nTerm, sqlite_int64 iDocid){ sqlite_int64 iFirst; sqlite_int64 iIndexRow; DocList doclist; int rc = term_chunk_select(v, zTerm, nTerm, iDocid, &iFirst); if( rc!=SQLITE_ROW ) return SQLITE_ERROR; rc = term_select(v, zTerm, nTerm, iFirst, &iIndexRow, &doclist); if( rc!=SQLITE_OK ) return rc; if( docListUpdate(&doclist, iDocid, NULL) ){ if( doclist.nData>0 ){ rc = term_update(v, iIndexRow, &doclist); } else { /* empty posting list */ rc = term_delete(v, iIndexRow); } } docListDestroy(&doclist); return rc; }