private void curNote_KeyDown(object sender, KeyEventArgs e) {
string s = util.key_to_action(e);
if (s == "return") {
// add note
string note_text = curNote.Text.Trim();
if (note_text == "")
return;
// see if I'm on a user's note (thus, i'm updating), or on a line (thus, i'm adding a note for that line)
string reply_to_note_id = "";
int sel = notesCtrl.SelectedIndex;
if (sel >= 0) {
var i = notesCtrl.GetItem(sel).RowObject as note_item;
bool is_edit = i.the_note != null && i.the_note.author_name == author_name_;
if (is_edit) {
dirty_ = true;
i.the_note.note_text = note_text;
// user modified the note
i.utc_last_edited = DateTime.UtcNow;
refresh_note(i);
return;
}
bool is_reply = i.the_note != null && i.the_note.author_name != author_name_;
if (is_reply)
reply_to_note_id = i.note_id;
}
note new_ = new note() { author_name = author_name_, author_initials = author_initials_,
author_color = author_color_, note_text = note_text, made_by_current_user = true, is_new = true };
add_note(new_, "", reply_to_note_id, false, DateTime.UtcNow);
refresh_notes();
}
}