1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** GUIX Component */ 17 /** */ 18 /** Multi Line Text Input Management(Multi Line Text Input) */ 19 /** */ 20 /**************************************************************************/ 21 22 #define GX_SOURCE_CODE 23 24 25 /* Include necessary system files. */ 26 27 #include "gx_api.h" 28 #include "gx_system.h" 29 #include "gx_utility.h" 30 #include "gx_window.h" 31 #include "gx_scrollbar.h" 32 #include "gx_multi_line_text_input.h" 33 #include "gx_multi_line_text_view.h" 34 35 /**************************************************************************/ 36 /* */ 37 /* FUNCTION RELEASE */ 38 /* */ 39 /* _gx_multi_line_text_input_char_remove PORTABLE C */ 40 /* 6.1 */ 41 /* AUTHOR */ 42 /* */ 43 /* Kenneth Maxwell, Microsoft Corporation */ 44 /* */ 45 /* DESCRIPTION */ 46 /* */ 47 /* This function removes a substring from a specified position */ 48 /* of input buffer. */ 49 /* */ 50 /* INPUT */ 51 /* */ 52 /* text_input Multi line text input control */ 53 /* block */ 54 /* start_pos Specified position in input */ 55 /* buffer */ 56 /* del_bytes The number of bytes that to */ 57 /* be removed */ 58 /* */ 59 /* OUTPUT */ 60 /* */ 61 /* None */ 62 /* */ 63 /* CALLS */ 64 /* */ 65 /* memmove Move the rest of the string */ 66 /* */ 67 /* CALLED BY */ 68 /* */ 69 /* _gx_multi_line_text_input_backspace */ 70 /* _gx_multi_line_text_input_delete */ 71 /* */ 72 /* RELEASE HISTORY */ 73 /* */ 74 /* DATE NAME DESCRIPTION */ 75 /* */ 76 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 77 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 78 /* resulting in version 6.1 */ 79 /* */ 80 /**************************************************************************/ _gx_multi_line_text_input_char_remove(GX_MULTI_LINE_TEXT_INPUT * text_input,UINT start_pos,UINT del_bytes)81UINT _gx_multi_line_text_input_char_remove(GX_MULTI_LINE_TEXT_INPUT *text_input, UINT start_pos, UINT del_bytes) 82 { 83 UINT string_size; 84 GX_CHAR *input_buffer; 85 86 input_buffer = (GX_CHAR *) text_input -> gx_multi_line_text_view_text.gx_string_ptr; 87 string_size = text_input -> gx_multi_line_text_view_text.gx_string_length; 88 memmove(input_buffer + start_pos, input_buffer + start_pos + del_bytes, string_size - start_pos - del_bytes); 89 input_buffer[string_size - del_bytes] = '\0'; 90 91 /* Update the input string size and cursor position. */ 92 text_input -> gx_multi_line_text_view_text.gx_string_length -= del_bytes; 93 94 /* Set the text modified flag to GX_TRUE. */ 95 text_input -> gx_multi_line_text_input_text_was_modified = GX_TRUE; 96 97 return GX_SUCCESS; 98 } 99 100