get_selected_code


Description:

public string get_selected_code ()

Gets the currently selected text (only valid for active file).

Convenience method that delegates to file.buffer.get_selection(). Updates cursor position and saves to database. Requires file.buffer to be non-null. Only works with GTK buffers (DummyFileBuffer returns empty string).

Process

  1. Gets selection from buffer (updates cursor position)

    2. Updates cursor_line and cursor_offset properties

    3. Saves to database (if manager.db is available)

Returns:

Selected text, or empty string if nothing is selected